@openleaf-editor/core 0.1.0-beta.0 → 0.1.0-beta.2
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/dist/autolink.d.ts +12 -0
- package/dist/autolink.d.ts.map +1 -0
- package/dist/autolink.js +98 -0
- package/dist/autolink.js.map +1 -0
- package/dist/commands.d.ts +109 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +639 -10
- package/dist/commands.js.map +1 -1
- package/dist/css.d.ts +176 -0
- package/dist/css.d.ts.map +1 -0
- package/dist/css.js +517 -0
- package/dist/css.js.map +1 -0
- package/dist/embed.d.ts +52 -0
- package/dist/embed.d.ts.map +1 -0
- package/dist/embed.js +116 -0
- package/dist/embed.js.map +1 -0
- package/dist/extensions.d.ts.map +1 -1
- package/dist/extensions.js +104 -4
- package/dist/extensions.js.map +1 -1
- package/dist/formats.d.ts +44 -0
- package/dist/formats.d.ts.map +1 -0
- package/dist/formats.js +111 -0
- package/dist/formats.js.map +1 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/keymap.d.ts.map +1 -1
- package/dist/keymap.js +15 -3
- package/dist/keymap.js.map +1 -1
- package/dist/noneditable.d.ts +14 -0
- package/dist/noneditable.d.ts.map +1 -0
- package/dist/noneditable.js +93 -0
- package/dist/noneditable.js.map +1 -0
- package/dist/preserve.d.ts +53 -0
- package/dist/preserve.d.ts.map +1 -1
- package/dist/preserve.js +133 -4
- package/dist/preserve.js.map +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +331 -61
- package/dist/schema.js.map +1 -1
- package/dist/structure.d.ts +44 -0
- package/dist/structure.d.ts.map +1 -0
- package/dist/structure.js +379 -0
- package/dist/structure.js.map +1 -0
- package/dist/tables.d.ts +13 -0
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +224 -19
- package/dist/tables.js.map +1 -1
- package/dist/tokens.d.ts +28 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +68 -0
- package/dist/tokens.js.map +1 -0
- package/dist/visual-aids.d.ts +10 -0
- package/dist/visual-aids.d.ts.map +1 -0
- package/dist/visual-aids.js +61 -0
- package/dist/visual-aids.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn a typed URL into a link when the author finishes it.
|
|
3
|
+
*
|
|
4
|
+
* Space and Enter are the commit keys, matching the behaviour authors already
|
|
5
|
+
* have in mail clients and office software. The plugin never rewrites a range
|
|
6
|
+
* that is already a link, and it refuses anything `isSafeUrl` would drop, so
|
|
7
|
+
* typing `javascript:` cannot become a mark the serializer would then emit.
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin } from 'prosemirror-state';
|
|
10
|
+
export declare function hrefFromTypedUrl(raw: string): string | null;
|
|
11
|
+
export declare function autolinkPlugin(): Plugin;
|
|
12
|
+
//# sourceMappingURL=autolink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autolink.d.ts","sourceRoot":"","sources":["../src/autolink.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAiD,MAAM,mBAAmB,CAAA;AAYzF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK3D;AAoCD,wBAAgB,cAAc,IAAI,MAAM,CA0BvC"}
|
package/dist/autolink.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn a typed URL into a link when the author finishes it.
|
|
3
|
+
*
|
|
4
|
+
* Space and Enter are the commit keys, matching the behaviour authors already
|
|
5
|
+
* have in mail clients and office software. The plugin never rewrites a range
|
|
6
|
+
* that is already a link, and it refuses anything `isSafeUrl` would drop, so
|
|
7
|
+
* typing `javascript:` cannot become a mark the serializer would then emit.
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
10
|
+
import { isSafeUrl } from './url.js';
|
|
11
|
+
const key = new PluginKey('openleaf-autolink');
|
|
12
|
+
/**
|
|
13
|
+
* A URL at the end of a typed run. `www.` is accepted because people type it;
|
|
14
|
+
* the href we store is always an absolute `https://` form, so the serializer
|
|
15
|
+
* never emits a scheme-less token a browser would treat as a relative path.
|
|
16
|
+
*/
|
|
17
|
+
const TRAILING_URL = /(?:https?:\/\/|www\.)[^\s<>"'()]+$/i;
|
|
18
|
+
export function hrefFromTypedUrl(raw) {
|
|
19
|
+
const trimmed = raw.replace(/[.,;:!?)]+$/, '');
|
|
20
|
+
if (!trimmed)
|
|
21
|
+
return null;
|
|
22
|
+
const href = /^www\./i.test(trimmed) ? `https://${trimmed}` : trimmed;
|
|
23
|
+
return isSafeUrl(href) ? href : null;
|
|
24
|
+
}
|
|
25
|
+
function trailingUrl(state, end) {
|
|
26
|
+
const $end = state.doc.resolve(end);
|
|
27
|
+
if (!$end.parent.isTextblock)
|
|
28
|
+
return null;
|
|
29
|
+
const parentStart = $end.start();
|
|
30
|
+
const raw = $end.parent.textBetween(0, $end.parentOffset, undefined, '\ufffc');
|
|
31
|
+
const trimmed = raw.replace(/[\s\u00a0]+$/, '');
|
|
32
|
+
const match = TRAILING_URL.exec(trimmed);
|
|
33
|
+
if (!match)
|
|
34
|
+
return null;
|
|
35
|
+
const href = hrefFromTypedUrl(match[0]);
|
|
36
|
+
if (!href)
|
|
37
|
+
return null;
|
|
38
|
+
const from = parentStart + (match.index ?? 0);
|
|
39
|
+
const to = parentStart + trimmed.length;
|
|
40
|
+
if (from >= to)
|
|
41
|
+
return null;
|
|
42
|
+
const link = state.schema.marks['link'];
|
|
43
|
+
if (!link)
|
|
44
|
+
return null;
|
|
45
|
+
if (state.doc.rangeHasMark(from, to, link))
|
|
46
|
+
return null;
|
|
47
|
+
return { from, to, href };
|
|
48
|
+
}
|
|
49
|
+
function applyAutolink(state, end) {
|
|
50
|
+
const found = trailingUrl(state, end);
|
|
51
|
+
if (!found)
|
|
52
|
+
return null;
|
|
53
|
+
const link = state.schema.marks['link'];
|
|
54
|
+
if (!link)
|
|
55
|
+
return null;
|
|
56
|
+
return state.tr.addMark(found.from, found.to, link.create({ href: found.href }));
|
|
57
|
+
}
|
|
58
|
+
function maybeAutolink(view, end) {
|
|
59
|
+
const tr = applyAutolink(view.state, end);
|
|
60
|
+
if (!tr)
|
|
61
|
+
return false;
|
|
62
|
+
view.dispatch(tr);
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
export function autolinkPlugin() {
|
|
66
|
+
return new Plugin({
|
|
67
|
+
key,
|
|
68
|
+
appendTransaction(transactions, _oldState, newState) {
|
|
69
|
+
if (!transactions.some((tr) => tr.docChanged))
|
|
70
|
+
return null;
|
|
71
|
+
if (transactions.some((tr) => tr.getMeta(key)))
|
|
72
|
+
return null;
|
|
73
|
+
const $from = newState.selection.$from;
|
|
74
|
+
if (!$from.parent.isTextblock || $from.parentOffset === 0)
|
|
75
|
+
return null;
|
|
76
|
+
const prev = $from.parent.textBetween($from.parentOffset - 1, $from.parentOffset);
|
|
77
|
+
if (prev !== ' ' && prev !== '\u00a0')
|
|
78
|
+
return null;
|
|
79
|
+
const tr = applyAutolink(newState, $from.pos);
|
|
80
|
+
return tr ? tr.setMeta(key, true) : null;
|
|
81
|
+
},
|
|
82
|
+
props: {
|
|
83
|
+
handleTextInput(view, from, _to, text) {
|
|
84
|
+
if (text !== ' ' && text !== '\u00a0')
|
|
85
|
+
return false;
|
|
86
|
+
maybeAutolink(view, from);
|
|
87
|
+
return false;
|
|
88
|
+
},
|
|
89
|
+
handleKeyDown(view, event) {
|
|
90
|
+
if (event.key !== 'Enter' || event.shiftKey)
|
|
91
|
+
return false;
|
|
92
|
+
maybeAutolink(view, view.state.selection.from);
|
|
93
|
+
return false;
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
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C,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI;gBACnC,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,QAAQ;oBAAE,OAAO,KAAK,CAAA;gBACnD,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;gBACzB,OAAO,KAAK,CAAA;YACd,CAAC;YACD,aAAa,CAAC,IAAI,EAAE,KAAK;gBACvB,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,IAAI,KAAK,CAAC,QAAQ;oBAAE,OAAO,KAAK,CAAA;gBACzD,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;gBAC9C,OAAO,KAAK,CAAA;YACd,CAAC;SACF;KACF,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/commands.d.ts
CHANGED
|
@@ -12,8 +12,10 @@
|
|
|
12
12
|
* reports whether it *could* apply, without doing anything. That is what makes
|
|
13
13
|
* button disabled-state free -- the same function answers "can I?" and "do it".
|
|
14
14
|
*/
|
|
15
|
-
import type
|
|
15
|
+
import { type Attrs } from 'prosemirror-model';
|
|
16
16
|
import type { Command, EditorState } from 'prosemirror-state';
|
|
17
|
+
import { type Align, type Dir, type ListStyle } from './css.js';
|
|
18
|
+
import { type ImageAlign } from './tokens.js';
|
|
17
19
|
/**
|
|
18
20
|
* Is this mark active at the cursor, or across the selection?
|
|
19
21
|
*
|
|
@@ -36,6 +38,8 @@ export declare const toggleItalic: Command;
|
|
|
36
38
|
export declare const toggleUnderline: Command;
|
|
37
39
|
export declare const toggleStrike: Command;
|
|
38
40
|
export declare const toggleInlineCode: Command;
|
|
41
|
+
export declare const toggleSubscript: Command;
|
|
42
|
+
export declare const toggleSuperscript: Command;
|
|
39
43
|
export declare const setParagraph: Command;
|
|
40
44
|
export declare function setHeading(level: number): Command;
|
|
41
45
|
/**
|
|
@@ -53,11 +57,81 @@ export declare const toggleOrderedList: Command;
|
|
|
53
57
|
export declare const splitListItemCommand: Command;
|
|
54
58
|
export declare const indentListItem: Command;
|
|
55
59
|
export declare const outdentListItem: Command;
|
|
60
|
+
/**
|
|
61
|
+
* Indent: nest a list item when the selection is in a list, otherwise add a
|
|
62
|
+
* `padding-inline-start` step on the text blocks. Outdent is the reverse, and
|
|
63
|
+
* lifting a top-level list item out of its list is still how you leave a list.
|
|
64
|
+
*/
|
|
65
|
+
export declare const indent: Command;
|
|
66
|
+
export declare const outdent: Command;
|
|
67
|
+
export declare function activeIndent(state: EditorState): number | null;
|
|
68
|
+
export declare function setListStyle(style: ListStyle | null): Command;
|
|
69
|
+
export declare function activeListStyle(state: EditorState): ListStyle | null;
|
|
70
|
+
/**
|
|
71
|
+
* The alignment of the selection, or null when it has none or is mixed.
|
|
72
|
+
*
|
|
73
|
+
* Null means "no explicit alignment", which is a genuinely different state from
|
|
74
|
+
* "aligned left" and is reported as such: an unaligned paragraph follows the
|
|
75
|
+
* document's reading direction, so it renders right-aligned in Arabic or Hebrew.
|
|
76
|
+
* Reporting it as left would make the left button light up on text that is not
|
|
77
|
+
* left-aligned, and would make `aria-pressed="true"` a lie about a paragraph
|
|
78
|
+
* nobody has aligned.
|
|
79
|
+
*
|
|
80
|
+
* A selection spanning blocks with different alignments also reports null.
|
|
81
|
+
* Showing the first block's value as the state of all of them is a lie the
|
|
82
|
+
* author acts on -- they see "centred", press it to turn it off, and one
|
|
83
|
+
* paragraph they never looked at moves.
|
|
84
|
+
*/
|
|
85
|
+
export declare function activeTextAlign(state: EditorState): Align | null;
|
|
86
|
+
/**
|
|
87
|
+
* Set the alignment of every alignable block in the selection. `null` clears it.
|
|
88
|
+
*
|
|
89
|
+
* Reports true whenever there is something to align, even if it already carries
|
|
90
|
+
* this value. The alternative -- returning false because the work is already
|
|
91
|
+
* done -- would make the toolbar render the button for the CURRENT alignment as
|
|
92
|
+
* disabled, since a command's no-dispatch call is what drives enabled state.
|
|
93
|
+
*/
|
|
94
|
+
export declare function setTextAlign(align: Align | null): Command;
|
|
95
|
+
/**
|
|
96
|
+
* Toggle an alignment: applying the one already in force clears it.
|
|
97
|
+
*
|
|
98
|
+
* The same reasoning as `toggleHeading`. An author who centred a paragraph by
|
|
99
|
+
* accident reaches for the control they just pressed, and having it do nothing
|
|
100
|
+
* because "centre" is already the value leaves them hunting for an
|
|
101
|
+
* un-centre button that does not exist.
|
|
102
|
+
*/
|
|
103
|
+
export declare function toggleTextAlign(align: Align): Command;
|
|
104
|
+
export declare function setLineHeight(value: string | null): Command;
|
|
105
|
+
export declare function activeLineHeight(state: EditorState): string | null;
|
|
106
|
+
export declare function setDir(dir: Dir | null): Command;
|
|
107
|
+
export declare function toggleDir(dir: Dir): Command;
|
|
108
|
+
export declare function activeDir(state: EditorState): Dir | null;
|
|
109
|
+
export declare function setTextColor(color: string): Command;
|
|
110
|
+
export declare function setBackgroundColor(color: string): Command;
|
|
111
|
+
export declare const clearTextColor: Command;
|
|
112
|
+
export declare const clearBackgroundColor: Command;
|
|
113
|
+
export declare function activeTextColor(state: EditorState): string | null;
|
|
114
|
+
export declare function activeBackgroundColor(state: EditorState): string | null;
|
|
115
|
+
export declare function setFontFamily(family: string | null): Command;
|
|
116
|
+
export declare function setFontSize(size: string | null): Command;
|
|
117
|
+
export declare function setLanguage(lang: string | null): Command;
|
|
118
|
+
export declare function activeFontFamily(state: EditorState): string | null;
|
|
119
|
+
export declare function activeFontSize(state: EditorState): string | null;
|
|
120
|
+
export declare function activeLanguage(state: EditorState): string | null;
|
|
121
|
+
/**
|
|
122
|
+
* Strip character formatting and block decoration from the selection.
|
|
123
|
+
*
|
|
124
|
+
* Links stay: they are a destination, not a look. Direction stays: it is
|
|
125
|
+
* content. Headings and lists stay: they are structure. Alignment, indent,
|
|
126
|
+
* line height, fonts, colours, and the common character marks go.
|
|
127
|
+
*/
|
|
128
|
+
export declare const clearFormatting: Command;
|
|
56
129
|
export interface LinkAttrs {
|
|
57
130
|
href: string;
|
|
58
131
|
title?: string | null;
|
|
59
132
|
target?: string | null;
|
|
60
133
|
rel?: string | null;
|
|
134
|
+
id?: string | null;
|
|
61
135
|
}
|
|
62
136
|
/**
|
|
63
137
|
* Apply or update a link across the selection.
|
|
@@ -74,8 +148,42 @@ export interface ImageAttrs {
|
|
|
74
148
|
title?: string | null;
|
|
75
149
|
width?: string | null;
|
|
76
150
|
height?: string | null;
|
|
151
|
+
align?: ImageAlign | null;
|
|
152
|
+
className?: string | null;
|
|
153
|
+
/**
|
|
154
|
+
* When present, the image is wrapped in `<figure>` with this caption.
|
|
155
|
+
* An empty string still wraps: a figure with no caption text is how an
|
|
156
|
+
* author says "this will have a caption" without writing one yet.
|
|
157
|
+
*/
|
|
158
|
+
caption?: string | null;
|
|
77
159
|
}
|
|
78
160
|
export declare function insertImage(attrs: ImageAttrs): Command;
|
|
161
|
+
export declare function insertText(text: string): Command;
|
|
162
|
+
export declare const insertNonBreakingSpace: Command;
|
|
163
|
+
export declare const insertPageBreak: Command;
|
|
164
|
+
export declare function insertNamedAnchor(id: string): Command;
|
|
165
|
+
export declare function setHeadingId(id: string | null): Command;
|
|
166
|
+
export declare function insertDetails(summaryText?: string): Command;
|
|
167
|
+
export interface MediaAttrs {
|
|
168
|
+
src: string;
|
|
169
|
+
title?: string | null;
|
|
170
|
+
width?: string | null;
|
|
171
|
+
height?: string | null;
|
|
172
|
+
controls?: boolean;
|
|
173
|
+
poster?: string | null;
|
|
174
|
+
allow?: string | null;
|
|
175
|
+
allowfullscreen?: boolean;
|
|
176
|
+
}
|
|
177
|
+
export declare function insertVideo(attrs: MediaAttrs): Command;
|
|
178
|
+
export declare function insertAudio(attrs: MediaAttrs): Command;
|
|
179
|
+
export declare function insertIframe(attrs: MediaAttrs): Command;
|
|
180
|
+
/**
|
|
181
|
+
* Parse HTML against the live schema and insert it.
|
|
182
|
+
*
|
|
183
|
+
* Used by the snippet picker. The HTML still goes through the same parse
|
|
184
|
+
* pipeline as stored content, so a snippet cannot smuggle in a `<script>`.
|
|
185
|
+
*/
|
|
186
|
+
export declare function insertHtml(html: string): Command;
|
|
79
187
|
export { redo, undo } from 'prosemirror-history';
|
|
80
188
|
export declare const canUndo: (state: EditorState) => boolean;
|
|
81
189
|
export declare const canRedo: (state: EditorState) => boolean;
|
package/dist/commands.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAS,KAAK,KAAK,EAAqD,MAAM,mBAAmB,CAAA;AAOxG,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EASL,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,SAAS,EACf,MAAM,UAAU,CAAA;AAGjB,OAAO,EAA8C,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AAgDzF;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAQ1E;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,CAiBzF;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CASvE;AAED,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CASpE;AAED,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,KAAK,GAAG,IAAI,CAiB3D;AAMD,eAAO,MAAM,UAAU,EAAE,OAA2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