@kungal/editor-core 0.31.1 → 0.32.1

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,5 +1,26 @@
1
1
  # @kungal/editor-core
2
2
 
3
+ ## 0.32.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 814c98f: Drive toolbar and bubble toggle-mark state from one editor plugin view, and keep the orphan-link cleanup out of undo history.
8
+
9
+ The previous Milkdown-listener + per-toolbar `refresh()` pair leaked subscriptions, missed stored-mark toggles for 200ms, and left the selection bubble without a pressed state. A single ProseMirror `view.update` plugin now writes one reactive record that the toolbar, the `#toolbar` slot, and the bubble all read. The leftover stored-link cleanup is marked `addToHistory: false`.
10
+
11
+ ## 0.32.0
12
+
13
+ ### Patch Changes
14
+
15
+ - 35bc140: Stop the link mark from leaking onto text typed after a link is deleted.
16
+
17
+ A link is a mark, so deleting its text left the link as a ProseMirror STORED
18
+ mark — the pending mark re-applied to the next keystroke — which is why typing
19
+ right after deleting a link kept producing linked text (the Space keymap only
20
+ cleared it while you kept typing). A new `$prose` plugin now clears the stored
21
+ link mark the moment the cursor is no longer inside a link, so the next
22
+ keystroke starts un-linked text.
23
+
3
24
  ## 0.31.1
4
25
 
5
26
  ### Patch Changes
@@ -12,9 +12,9 @@ var inputrules = require('@milkdown/kit/prose/inputrules');
12
12
  var utils = require('@milkdown/kit/utils');
13
13
  var unistUtilVisit = require('unist-util-visit');
14
14
  var core = require('@milkdown/kit/core');
15
+ var state = require('@milkdown/kit/prose/state');
15
16
  var commands = require('@milkdown/kit/prose/commands');
16
17
  var prose = require('@milkdown/kit/prose');
17
- var state = require('@milkdown/kit/prose/state');
18
18
  var katex = require('katex');
19
19
  var remarkMath = require('remark-math');
20
20
  var codeBlock = require('@milkdown/kit/component/code-block');
@@ -181,7 +181,9 @@ var stopLinkCommand = utils.$command("StopLink", (ctx) => () => {
181
181
  const markType = commonmark.linkSchema.type(ctx);
182
182
  const checkMark = hasMark(state, markType);
183
183
  if (checkMark) {
184
- dispatch?.(state.tr.removeStoredMark(markType));
184
+ dispatch?.(
185
+ state.tr.removeStoredMark(markType).setMeta("addToHistory", false)
186
+ );
185
187
  }
186
188
  return false;
187
189
  };
@@ -195,7 +197,27 @@ var linkCustomKeymap = utils.$useKeymap("linkCustomKeymap", {
195
197
  }
196
198
  }
197
199
  });
198
- var createStopLinkPlugin = () => [stopLinkCommand, linkCustomKeymap].flat();
200
+ var orphanLinkKey = new state.PluginKey("KUN_ORPHAN_LINK");
201
+ var clearOrphanLink = utils.$prose(
202
+ (ctx) => new state.Plugin({
203
+ key: orphanLinkKey,
204
+ appendTransaction(_transactions, _oldState, newState) {
205
+ const { storedMarks, selection } = newState;
206
+ if (!selection.empty || !storedMarks) {
207
+ return null;
208
+ }
209
+ const linkType = commonmark.linkSchema.type(ctx);
210
+ if (!linkType.isInSet(storedMarks)) {
211
+ return null;
212
+ }
213
+ if (linkType.isInSet(selection.$from.marks())) {
214
+ return null;
215
+ }
216
+ return newState.tr.removeStoredMark(linkType).setMeta("addToHistory", false);
217
+ }
218
+ })
219
+ );
220
+ var createStopLinkPlugin = () => [stopLinkCommand, linkCustomKeymap, clearOrphanLink].flat();
199
221
  var insertLinkCommand = utils.$command(
200
222
  "InsertKunLink",
201
223
  (ctx) => (payload) => (state, dispatch) => {