diff options
| author | Melissa Zhang <mzhang19096@gmail.com> | 2020-06-18 22:16:57 -0700 | 
|---|---|---|
| committer | Melissa Zhang <mzhang19096@gmail.com> | 2020-06-18 22:16:57 -0700 | 
| commit | b79b5ebfd4f8ea8b4ae793e59f05b5bfe79b9b8a (patch) | |
| tree | 3696946f79cd29007e9192fa9a93e5a3a9818a74 /src/client/views/nodes/formattedText/RichTextMenu.tsx | |
| parent | 8a5c91740f1a8bc4dca2e99bba1da3a1ed1f591b (diff) | |
| parent | d8feecd0542670233e6ea87006a89eb00d10a17e (diff) | |
merge with master
Diffstat (limited to 'src/client/views/nodes/formattedText/RichTextMenu.tsx')
| -rw-r--r-- | src/client/views/nodes/formattedText/RichTextMenu.tsx | 8 | 
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client/views/nodes/formattedText/RichTextMenu.tsx b/src/client/views/nodes/formattedText/RichTextMenu.tsx index fd1b26208..03d393cde 100644 --- a/src/client/views/nodes/formattedText/RichTextMenu.tsx +++ b/src/client/views/nodes/formattedText/RichTextMenu.tsx @@ -631,7 +631,7 @@ export default class RichTextMenu extends AntimodeMenu {          const node = this.view.state.selection.$from.nodeAfter;          const link = node && node.marks.find(m => m.type.name === "link");          if (link) { -            const href = link.attrs.href; +            const href = link.attrs.allHrefs.length > 0 ? link.attrs.allHrefs[0].href : undefined;              if (href) {                  if (href.indexOf(Utils.prepend("/doc/")) === 0) {                      const linkclicked = href.replace(Utils.prepend("/doc/"), "").split("?")[0]; @@ -677,7 +677,7 @@ export default class RichTextMenu extends AntimodeMenu {          const node = this.view.state.selection.$from.nodeAfter;          const link = node && node.marks.find(m => m.type === this.view!.state.schema.marks.link); -        const href = link!.attrs.href; +        const href = link!.attrs.allHrefs.length > 0 ? link!.attrs.allHrefs[0].href : undefined;          if (href) {              if (href.indexOf(Utils.prepend("/doc/")) === 0) {                  const linkclicked = href.replace(Utils.prepend("/doc/"), "").split("?")[0]; @@ -705,8 +705,8 @@ export default class RichTextMenu extends AntimodeMenu {          let startIndex = $start.index();          let endIndex = $start.indexAfter(); -        while (startIndex > 0 && $start.parent.child(startIndex - 1).marks.filter(m => m.type === mark && m.attrs.href === href).length) startIndex--; -        while (endIndex < $start.parent.childCount && $start.parent.child(endIndex).marks.filter(m => m.type === mark && m.attrs.href === href).length) endIndex++; +        while (startIndex > 0 && $start.parent.child(startIndex - 1).marks.filter(m => m.type === mark && m.attrs.allHrefs.find((item: { href: string }) => item.href === href)).length) startIndex--; +        while (endIndex < $start.parent.childCount && $start.parent.child(endIndex).marks.filter(m => m.type === mark && m.attrs.allHrefs.find((item: { href: string }) => item.href === href)).length) endIndex++;          let startPos = $start.start();          let endPos = startPos;  | 
