|
|
@@ -187,7 +187,14 @@ class LinkEditModal extends React.PureComponent {
|
|
|
|
|
|
let reshapedLink = linkInputValue;
|
|
|
if (isUseRelativePath && linkInputValue.match(/^\//)) {
|
|
|
- reshapedLink = path.relative(pageContainer.state.path, linkInputValue);
|
|
|
+ const pagePath = pageContainer.state.path;
|
|
|
+ // rootPaths of md link and pukiwiki link are different
|
|
|
+ const rootPath = linkerType === Linker.types.markdownLink ? path.dirname(pagePath) : pagePath;
|
|
|
+ reshapedLink = path.relative(rootPath, linkInputValue);
|
|
|
+ if (!reshapedLink.startsWith('.')) {
|
|
|
+ reshapedLink = `./${reshapedLink}`;
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return new Linker(
|