@limetech/lime-elements 37.53.2 → 37.53.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [37.53.3](https://github.com/Lundalogik/lime-elements/compare/v37.53.2...v37.53.3) (2024-07-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+
7
+ * **text-editor:** selected text now used for copying link text ([39e40c6](https://github.com/Lundalogik/lime-elements/commit/39e40c66a11a07d7346d2a26c38badf9f892aff4))
8
+ * **text-editor:** selected text now used for copying link text across nodes ([2350727](https://github.com/Lundalogik/lime-elements/commit/23507278d4edd16c374b2fe72b73b5e1348758e4))
9
+
1
10
  ## [37.53.2](https://github.com/Lundalogik/lime-elements/compare/v37.53.1...v37.53.2) (2024-06-27)
2
11
 
3
12
 
@@ -25631,15 +25631,18 @@ const updateLink = (view, updateLinkCallback) => {
25631
25631
  const { from, to } = view.state.selection;
25632
25632
  let text = '';
25633
25633
  let href = '';
25634
- view.state.doc.nodesBetween(from, to, (node) => {
25635
- if (node.type.name === 'text') {
25636
- text = node.text;
25637
- node.marks.forEach((mark) => {
25638
- if (mark.type.name === 'link') {
25639
- href = mark.attrs.href;
25640
- }
25641
- });
25634
+ view.state.doc.nodesBetween(from, to, (node, pos) => {
25635
+ if (node.type.name !== 'text') {
25636
+ return;
25642
25637
  }
25638
+ const fromInNode = Math.max(0, from - pos);
25639
+ const toInNode = Math.min(node.text.length, to - pos);
25640
+ text += node.text.slice(fromInNode, toInNode);
25641
+ node.marks.forEach((mark) => {
25642
+ if (mark.type.name === 'link') {
25643
+ href = mark.attrs.href;
25644
+ }
25645
+ });
25643
25646
  });
25644
25647
  if (updateLinkCallback) {
25645
25648
  updateLinkCallback(text, href);