yusuketk 5 лет назад
Родитель
Сommit
ee591ffae5
1 измененных файлов с 7 добавлено и 2 удалено
  1. 7 2
      src/client/js/components/PageEditor/LinkEditModal.jsx

+ 7 - 2
src/client/js/components/PageEditor/LinkEditModal.jsx

@@ -75,9 +75,14 @@ class LinkEditModal extends React.PureComponent {
       type = Linker.types.markdownLink;
       type = Linker.types.markdownLink;
     }
     }
 
 
+    let isUseRelativePath = false;
+
     const url = new URL(link, 'http://example.com');
     const url = new URL(link, 'http://example.com');
-    const isUseRelativePath = url.origin === 'http://example.com' && !link.startsWith('/') && link !== '';
-    if (isUseRelativePath) {
+    if (url.origin === window.location.origin) {
+      link = decodeURI(url.pathname);
+    }
+    else if (url.origin === 'http://example.com' && !link.startsWith('/') && link !== '') {
+      isUseRelativePath = true;
       const rootPath = this.getRootPath(type);
       const rootPath = this.getRootPath(type);
       link = path.resolve(rootPath, link);
       link = path.resolve(rootPath, link);
     }
     }