@kungal/editor-core 0.31.0 → 0.32.0
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 +53 -0
- package/dist/preset/index.cjs +22 -2
- package/dist/preset/index.cjs.map +1 -1
- package/dist/preset/index.d.cts +3 -2
- package/dist/preset/index.d.ts +3 -2
- package/dist/preset/index.js +22 -2
- package/dist/preset/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# @kungal/editor-core
|
|
2
2
|
|
|
3
|
+
## 0.32.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 35bc140: Stop the link mark from leaking onto text typed after a link is deleted.
|
|
8
|
+
|
|
9
|
+
A link is a mark, so deleting its text left the link as a ProseMirror STORED
|
|
10
|
+
mark — the pending mark re-applied to the next keystroke — which is why typing
|
|
11
|
+
right after deleting a link kept producing linked text (the Space keymap only
|
|
12
|
+
cleared it while you kept typing). A new `$prose` plugin now clears the stored
|
|
13
|
+
link mark the moment the cursor is no longer inside a link, so the next
|
|
14
|
+
keystroke starts un-linked text.
|
|
15
|
+
|
|
16
|
+
## 0.31.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- b7fe837: Fix a long `placeholder` overflowing the editor, and ship the reference
|
|
21
|
+
stylesheet from the layer.
|
|
22
|
+
|
|
23
|
+
The placeholder is a decoration (`.kun-editor__placeholder` +
|
|
24
|
+
`data-placeholder`) rendered by the host's `::before` rule. That rule was
|
|
25
|
+
absolutely positioned with **no positioned ancestor**, so the browser laid it
|
|
26
|
+
out against the viewport: a long placeholder ran past the editor's right edge —
|
|
27
|
+
and could even paint over the toolbar — instead of wrapping inside it. The
|
|
28
|
+
empty block is now the containing block, and the text wraps (`width: 100%` +
|
|
29
|
+
`overflow-wrap: break-word`):
|
|
30
|
+
|
|
31
|
+
```css
|
|
32
|
+
.kun-editor__placeholder {
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
.kun-editor__placeholder::before {
|
|
36
|
+
content: attr(data-placeholder);
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 0;
|
|
39
|
+
left: 0;
|
|
40
|
+
width: 100%;
|
|
41
|
+
overflow-wrap: break-word;
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Because that CSS lived only in the docs app, every host had a _copy_ — an
|
|
46
|
+
upstream style fix could never reach them. The reference stylesheet now ships
|
|
47
|
+
with `@kungal/editor-nuxt`, so hosts can import it and get fixes with a version
|
|
48
|
+
bump (copying it still works):
|
|
49
|
+
|
|
50
|
+
```css
|
|
51
|
+
@import "@kungal/editor-nuxt/editor.css";
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`@kungal/editor-vue` is unchanged and still headless (zero CSS).
|
|
55
|
+
|
|
3
56
|
## 0.31.0
|
|
4
57
|
|
|
5
58
|
## 0.30.0
|
package/dist/preset/index.cjs
CHANGED
|
@@ -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');
|
|
@@ -195,7 +195,27 @@ var linkCustomKeymap = utils.$useKeymap("linkCustomKeymap", {
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
});
|
|
198
|
-
var
|
|
198
|
+
var orphanLinkKey = new state.PluginKey("KUN_ORPHAN_LINK");
|
|
199
|
+
var clearOrphanLink = utils.$prose(
|
|
200
|
+
(ctx) => new state.Plugin({
|
|
201
|
+
key: orphanLinkKey,
|
|
202
|
+
appendTransaction(_transactions, _oldState, newState) {
|
|
203
|
+
const { storedMarks, selection } = newState;
|
|
204
|
+
if (!selection.empty || !storedMarks) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
const linkType = commonmark.linkSchema.type(ctx);
|
|
208
|
+
if (!storedMarks.some((m) => m.type === linkType)) {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
if (selection.$from.marks().some((m) => m.type === linkType)) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
return newState.tr.removeStoredMark(linkType);
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
);
|
|
218
|
+
var createStopLinkPlugin = () => [stopLinkCommand, linkCustomKeymap, clearOrphanLink].flat();
|
|
199
219
|
var insertLinkCommand = utils.$command(
|
|
200
220
|
"InsertKunLink",
|
|
201
221
|
(ctx) => (payload) => (state, dispatch) => {
|