From 2b44ab61023608c5a58f29b928dc1064125f548b Mon Sep 17 00:00:00 2001 From: Nulo Date: Thu, 31 Aug 2023 15:02:58 -0300 Subject: [PATCH] apropiadamente implementar nuevo linkeo --- package.json | 2 +- pnpm-lock.yaml | 30 +++++----- src/editor/BubbleMenu.svelte | 70 +++++++---------------- src/editor/Editor.svelte | 2 +- src/editor/bubblemenu/EditLinkMenu.svelte | 24 ++++---- src/editor/bubblemenu/LinkTooltip.svelte | 18 +++--- src/editor/bubblemenu/floatingUi.ts | 47 +++++++++------ 7 files changed, 88 insertions(+), 105 deletions(-) diff --git a/package.json b/package.json index 741fb5d..7688183 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "prosemirror-schema-list": "~1.2.2", "prosemirror-state": "~1.4.2", "prosemirror-transform": "~1.7.1", - "prosemirror-view": "~1.29.2", + "prosemirror-view": "^1.31.7", "svelte": "^3.58.0", "svelte-check": "^2.10.3", "tailwindcss": "^3.3.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 786d592..4aeac7e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,7 +31,7 @@ dependencies: version: 9.0.10(yjs@13.5.52) y-prosemirror: specifier: ^1.2.1 - version: 1.2.1(prosemirror-model@1.18.3)(prosemirror-state@1.4.2)(prosemirror-view@1.29.2)(y-protocols@1.0.5)(yjs@13.5.52) + version: 1.2.1(prosemirror-model@1.18.3)(prosemirror-state@1.4.2)(prosemirror-view@1.31.7)(y-protocols@1.0.5)(yjs@13.5.52) y-protocols: specifier: ^1.0.5 version: 1.0.5 @@ -107,8 +107,8 @@ devDependencies: specifier: ~1.7.1 version: 1.7.1 prosemirror-view: - specifier: ~1.29.2 - version: 1.29.2 + specifier: ^1.31.7 + version: 1.31.7 svelte: specifier: ^3.58.0 version: 3.58.0 @@ -595,7 +595,7 @@ packages: normalize-path: 3.0.0 readdirp: 3.6.0 optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true /commander@4.1.1: @@ -796,8 +796,8 @@ packages: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} dev: true - /fsevents@2.3.2: - resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] requiresBuild: true @@ -1307,7 +1307,7 @@ packages: dependencies: prosemirror-state: 1.4.2 prosemirror-transform: 1.7.1 - prosemirror-view: 1.29.2 + prosemirror-view: 1.31.7 dev: true /prosemirror-gapcursor@1.3.1: @@ -1316,7 +1316,7 @@ packages: prosemirror-keymap: 1.2.1 prosemirror-model: 1.18.3 prosemirror-state: 1.4.2 - prosemirror-view: 1.29.2 + prosemirror-view: 1.31.7 dev: true /prosemirror-history@1.3.0: @@ -1371,15 +1371,15 @@ packages: dependencies: prosemirror-model: 1.18.3 prosemirror-transform: 1.7.1 - prosemirror-view: 1.29.2 + prosemirror-view: 1.31.7 /prosemirror-transform@1.7.1: resolution: {integrity: sha512-VteoifAfpt46z0yEt6Fc73A5OID9t/y2QIeR5MgxEwTuitadEunD/V0c9jQW8ziT8pbFM54uTzRLJ/nLuQjMxg==} dependencies: prosemirror-model: 1.18.3 - /prosemirror-view@1.29.2: - resolution: {integrity: sha512-T4Wm+eTpTH0N9gBJfJR6iecjRX2hYTKewoJUwa92hQOoEz2bYVZy6sYeN+hfnRR506TRvRcuZYqftp4KA8dN+Q==} + /prosemirror-view@1.31.7: + resolution: {integrity: sha512-Pr7w93yOYmxQwzGIRSaNLZ/1uM6YjnenASzN2H6fO6kGekuzRbgZ/4bHbBTd1u4sIQmL33/TcGmzxxidyPwCjg==} dependencies: prosemirror-model: 1.18.3 prosemirror-state: 1.4.2 @@ -1457,7 +1457,7 @@ packages: engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true /rope-sequence@1.3.3: @@ -1797,7 +1797,7 @@ packages: resolve: 1.22.2 rollup: 3.20.6 optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true /vitefu@0.2.4(vite@4.2.2): @@ -1843,7 +1843,7 @@ packages: yjs: 13.5.52 dev: false - /y-prosemirror@1.2.1(prosemirror-model@1.18.3)(prosemirror-state@1.4.2)(prosemirror-view@1.29.2)(y-protocols@1.0.5)(yjs@13.5.52): + /y-prosemirror@1.2.1(prosemirror-model@1.18.3)(prosemirror-state@1.4.2)(prosemirror-view@1.31.7)(y-protocols@1.0.5)(yjs@13.5.52): resolution: {integrity: sha512-czMBfB1eL2awqmOSxQM8cS/fsUOGE6fjvyPLInrh4crPxFiw67wDpwIW+EGBYKRa04sYbS0ScGj7ZgvWuDrmBQ==} peerDependencies: prosemirror-model: ^1.7.1 @@ -1855,7 +1855,7 @@ packages: lib0: 0.2.73 prosemirror-model: 1.18.3 prosemirror-state: 1.4.2 - prosemirror-view: 1.29.2 + prosemirror-view: 1.31.7 y-protocols: 1.0.5 yjs: 13.5.52 dev: false diff --git a/src/editor/BubbleMenu.svelte b/src/editor/BubbleMenu.svelte index 2844cd9..0c325e0 100644 --- a/src/editor/BubbleMenu.svelte +++ b/src/editor/BubbleMenu.svelte @@ -1,5 +1,6 @@ diff --git a/src/editor/bubblemenu/LinkTooltip.svelte b/src/editor/bubblemenu/LinkTooltip.svelte index a59d150..b51be4b 100644 --- a/src/editor/bubblemenu/LinkTooltip.svelte +++ b/src/editor/bubblemenu/LinkTooltip.svelte @@ -3,11 +3,10 @@ import { getFirstMarkInSelection, getMarkRange, - removeMark, selectMark, } from "../ps-utils"; import type { EditorView } from "prosemirror-view"; - import { markSelectionFloatingUi } from "./floatingUi"; + import { linkFloatingUi, selectionFloatingUi } from "./floatingUi"; import { readable, type Writable } from "svelte/store"; import { flip, shift, offset } from "@floating-ui/dom"; import EditIcon from "eva-icons/outline/svg/edit-outline.svg"; @@ -22,13 +21,12 @@ $: link = state && getFirstMarkInSelection(view.state, markType); $: shown = !!link && !$editingLink; - $: style = - shown && link - ? markSelectionFloatingUi(view, link, tooltipEl, { - placement: "bottom", - middleware: [offset(6), flip(), shift({ padding: 5 })], - }) - : readable(""); + $: style = shown + ? linkFloatingUi(view, tooltipEl, { + placement: "bottom", + middleware: [offset(6), flip(), shift({ padding: 5 })], + }) + : readable(""); function editLink() { if (!link) return; @@ -44,7 +42,7 @@
, ): Readable