@onereach/ui-components 10.2.1-beta.4275.0 → 10.2.1-beta.4276.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/dist/bundled/v2/components/OrCardCollectionV3/OrCardCollection.js +11 -9
- package/dist/bundled/v2/components/OrCardCollectionV3/OrCardCollection.vue.d.ts +2 -0
- package/dist/bundled/v2/components/OrCardCollectionV3/styles.d.ts +1 -0
- package/dist/bundled/v2/components/OrCardCollectionV3/styles.js +5 -2
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +252 -382
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +68 -21
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +0 -1
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +4 -5
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +1 -1
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +1 -1
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +2 -2
- package/dist/bundled/v2/{index-0e9c2b43.js → index-02a897ac.js} +1 -1
- package/dist/bundled/v2/{index-f379c836.js → index-7516cf60.js} +173 -258
- package/dist/bundled/v2/{markdown-2d22cf16.js → markdown-fe3bfb01.js} +113 -66
- package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.js +1 -1
- package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.vue.d.ts +1 -0
- package/dist/bundled/v3/components/OrCardCollectionV3/index.js +1 -1
- package/dist/bundled/v3/components/OrCardCollectionV3/props.js +1 -1
- package/dist/bundled/v3/components/OrCardCollectionV3/styles.d.ts +1 -0
- package/dist/bundled/v3/components/OrCardCollectionV3/styles.js +1 -1
- package/dist/bundled/v3/components/{OrCardCollectionV3-8ddb17cf.js → OrCardCollectionV3-b9d360ef.js} +16 -10
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +18 -14
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/props.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +0 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +1 -1
- package/dist/bundled/v3/components/{OrRichTextEditorV3-45e64a85.js → OrRichTextEditorV3-358d7df2.js} +532 -674
- package/dist/bundled/v3/components/index.js +2 -2
- package/dist/bundled/v3/index.js +2 -2
- package/dist/esm/v2/{OrCardCollection-e14978d3.js → OrCardCollection-2a2c0b31.js} +14 -9
- package/dist/esm/v2/{OrRichTextEditor-fbcc33fd.js → OrRichTextEditor-734b8b27.js} +244 -353
- package/dist/esm/v2/components/index.js +2 -2
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +2 -0
- package/dist/esm/v2/components/or-card-collection-v3/index.js +1 -1
- package/dist/esm/v2/components/or-card-collection-v3/styles.d.ts +1 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +68 -21
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +7 -7
- package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +0 -1
- package/dist/esm/v2/index.js +2 -2
- package/dist/esm/v3/{OrCardCollection-65c9e771.js → OrCardCollection-a39155b7.js} +15 -9
- package/dist/esm/v3/{OrRichTextEditor-cdd9e3e4.js → OrRichTextEditor-b5684aab.js} +242 -325
- package/dist/esm/v3/components/index.js +2 -2
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +1 -0
- package/dist/esm/v3/components/or-card-collection-v3/index.js +1 -1
- package/dist/esm/v3/components/or-card-collection-v3/styles.d.ts +1 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +18 -14
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +6 -6
- package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +0 -1
- package/dist/esm/v3/index.js +2 -2
- package/package.json +18 -18
- package/src/components/or-card-collection-v3/OrCardCollection.vue +25 -14
- package/src/components/or-card-collection-v3/styles.ts +6 -1
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +203 -48
- package/src/components/or-rich-text-editor-v3/styles.ts +10 -13
- package/dist/esm/v2/components/or-rich-text-editor-v3/partials/EditorToolbar.vue.d.ts +0 -160
- package/dist/esm/v3/components/or-rich-text-editor-v3/partials/EditorToolbar.vue.d.ts +0 -89
- package/src/components/or-rich-text-editor-v3/partials/EditorToolbar.vue +0 -238
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TextSelection, N as NodeSelection, S as Selection, b as Slice, d as dropPoint, f as DOMSerializer, F as Fragment, D as DOMParser, A as AllSelection, e as Mark$1, P as Plugin, g as NodeRange, h as findWrapping, R as ReplaceAroundStep, i as canSplit, l as liftTarget, j as canJoin, a as PluginKey, E as EditorState, k as createParagraphNear$1, m as deleteSelection$1, n as exitCode$1, o as joinUp$1, p as joinDown$1, q as joinBackward$1, r as joinForward$1, s as
|
|
1
|
+
import { T as TextSelection, N as NodeSelection, S as Selection, b as Slice, d as dropPoint, f as DOMSerializer, F as Fragment, D as DOMParser, A as AllSelection, e as Mark$1, P as Plugin, g as NodeRange, h as findWrapping, R as ReplaceAroundStep, i as canSplit, l as liftTarget, j as canJoin, a as PluginKey, E as EditorState, k as createParagraphNear$1, m as deleteSelection$1, n as exitCode$1, o as joinUp$1, p as joinDown$1, q as joinBackward$1, r as joinForward$1, s as lift$1, t as liftEmptyBlock$1, u as newlineInCode$1, v as selectNodeBackward$1, w as selectNodeForward$1, x as selectParentNode$1, y as selectTextblockEnd$1, z as selectTextblockStart$1, B as Transform, C as setBlockType, G as wrapIn$1, c as Schema, H as ReplaceStep } from './index-02a897ac.js';
|
|
2
2
|
import { k as keyName, b as base } from './index-0fa7e6ca.js';
|
|
3
3
|
|
|
4
4
|
const domIndex = function (node) {
|
|
@@ -5563,6 +5563,9 @@ class CommandManager {
|
|
|
5563
5563
|
const {
|
|
5564
5564
|
view
|
|
5565
5565
|
} = editor;
|
|
5566
|
+
if (state.storedMarks) {
|
|
5567
|
+
tr.setStoredMarks(state.storedMarks);
|
|
5568
|
+
}
|
|
5566
5569
|
const props = {
|
|
5567
5570
|
tr,
|
|
5568
5571
|
editor,
|
|
@@ -5572,7 +5575,7 @@ class CommandManager {
|
|
|
5572
5575
|
transaction: tr
|
|
5573
5576
|
}),
|
|
5574
5577
|
dispatch: shouldDispatch ? () => undefined : undefined,
|
|
5575
|
-
chain: () => this.createChain(tr
|
|
5578
|
+
chain: () => this.createChain(tr),
|
|
5576
5579
|
can: () => this.createCan(tr),
|
|
5577
5580
|
get commands() {
|
|
5578
5581
|
return Object.fromEntries(Object.entries(rawCommands).map(_ref4 => {
|
|
@@ -5751,10 +5754,7 @@ function mergeAttributes() {
|
|
|
5751
5754
|
return;
|
|
5752
5755
|
}
|
|
5753
5756
|
if (key === 'class') {
|
|
5754
|
-
|
|
5755
|
-
const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(' ') : [];
|
|
5756
|
-
const insertClasses = valueClasses.filter(valueClass => !existingClasses.includes(valueClass));
|
|
5757
|
-
mergedAttributes[key] = [...existingClasses, ...insertClasses].join(' ');
|
|
5757
|
+
mergedAttributes[key] = [mergedAttributes[key], value].join(' ');
|
|
5758
5758
|
} else if (key === 'style') {
|
|
5759
5759
|
mergedAttributes[key] = [mergedAttributes[key], value].join('; ');
|
|
5760
5760
|
} else {
|
|
@@ -6221,9 +6221,7 @@ function run(config) {
|
|
|
6221
6221
|
state,
|
|
6222
6222
|
from,
|
|
6223
6223
|
to,
|
|
6224
|
-
rule
|
|
6225
|
-
pasteEvent,
|
|
6226
|
-
dropEvent
|
|
6224
|
+
rule
|
|
6227
6225
|
} = config;
|
|
6228
6226
|
const {
|
|
6229
6227
|
commands,
|
|
@@ -6258,9 +6256,7 @@ function run(config) {
|
|
|
6258
6256
|
match,
|
|
6259
6257
|
commands,
|
|
6260
6258
|
chain,
|
|
6261
|
-
can
|
|
6262
|
-
pasteEvent,
|
|
6263
|
-
dropEvent
|
|
6259
|
+
can
|
|
6264
6260
|
});
|
|
6265
6261
|
handlers.push(handler);
|
|
6266
6262
|
});
|
|
@@ -6281,8 +6277,6 @@ function pasteRulesPlugin(props) {
|
|
|
6281
6277
|
let dragSourceElement = null;
|
|
6282
6278
|
let isPastedFromProseMirror = false;
|
|
6283
6279
|
let isDroppedFromProseMirror = false;
|
|
6284
|
-
let pasteEvent = new ClipboardEvent('paste');
|
|
6285
|
-
let dropEvent = new DragEvent('drop');
|
|
6286
6280
|
const plugins = rules.map(rule => {
|
|
6287
6281
|
return new Plugin({
|
|
6288
6282
|
// we register a global drag handler to track the current drag source element
|
|
@@ -6300,15 +6294,13 @@ function pasteRulesPlugin(props) {
|
|
|
6300
6294
|
},
|
|
6301
6295
|
props: {
|
|
6302
6296
|
handleDOMEvents: {
|
|
6303
|
-
drop:
|
|
6297
|
+
drop: view => {
|
|
6304
6298
|
isDroppedFromProseMirror = dragSourceElement === view.dom.parentElement;
|
|
6305
|
-
dropEvent = event;
|
|
6306
6299
|
return false;
|
|
6307
6300
|
},
|
|
6308
|
-
paste: (
|
|
6301
|
+
paste: (view, event) => {
|
|
6309
6302
|
var _a;
|
|
6310
6303
|
const html = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text/html');
|
|
6311
|
-
pasteEvent = event;
|
|
6312
6304
|
isPastedFromProseMirror = !!(html === null || html === void 0 ? void 0 : html.includes('data-pm-slice'));
|
|
6313
6305
|
return false;
|
|
6314
6306
|
}
|
|
@@ -6339,16 +6331,12 @@ function pasteRulesPlugin(props) {
|
|
|
6339
6331
|
state: chainableState,
|
|
6340
6332
|
from: Math.max(from - 1, 0),
|
|
6341
6333
|
to: to.b - 1,
|
|
6342
|
-
rule
|
|
6343
|
-
pasteEvent,
|
|
6344
|
-
dropEvent
|
|
6334
|
+
rule
|
|
6345
6335
|
});
|
|
6346
6336
|
// stop if there are no changes
|
|
6347
6337
|
if (!handler || !tr.steps.length) {
|
|
6348
6338
|
return;
|
|
6349
6339
|
}
|
|
6350
|
-
dropEvent = new DragEvent('drop');
|
|
6351
|
-
pasteEvent = new ClipboardEvent('paste');
|
|
6352
6340
|
return tr;
|
|
6353
6341
|
}
|
|
6354
6342
|
});
|
|
@@ -6844,26 +6832,11 @@ const createParagraphNear = () => _ref16 => {
|
|
|
6844
6832
|
} = _ref16;
|
|
6845
6833
|
return createParagraphNear$1(state, dispatch);
|
|
6846
6834
|
};
|
|
6847
|
-
const
|
|
6848
|
-
let {
|
|
6849
|
-
editor,
|
|
6850
|
-
tr
|
|
6851
|
-
} = _ref17;
|
|
6852
|
-
const {
|
|
6853
|
-
state
|
|
6854
|
-
} = editor;
|
|
6855
|
-
const contentSlice = state.doc.slice(originRange.from, originRange.to);
|
|
6856
|
-
tr.deleteRange(originRange.from, originRange.to);
|
|
6857
|
-
const newPos = tr.mapping.map(targetPos);
|
|
6858
|
-
tr.insert(newPos, contentSlice.content);
|
|
6859
|
-
tr.setSelection(new TextSelection(tr.doc.resolve(newPos - 1)));
|
|
6860
|
-
return true;
|
|
6861
|
-
};
|
|
6862
|
-
const deleteCurrentNode = () => _ref18 => {
|
|
6835
|
+
const deleteCurrentNode = () => _ref17 => {
|
|
6863
6836
|
let {
|
|
6864
6837
|
tr,
|
|
6865
6838
|
dispatch
|
|
6866
|
-
} =
|
|
6839
|
+
} = _ref17;
|
|
6867
6840
|
const {
|
|
6868
6841
|
selection
|
|
6869
6842
|
} = tr;
|
|
@@ -6886,12 +6859,12 @@ const deleteCurrentNode = () => _ref18 => {
|
|
|
6886
6859
|
}
|
|
6887
6860
|
return false;
|
|
6888
6861
|
};
|
|
6889
|
-
const deleteNode = typeOrName =>
|
|
6862
|
+
const deleteNode = typeOrName => _ref18 => {
|
|
6890
6863
|
let {
|
|
6891
6864
|
tr,
|
|
6892
6865
|
state,
|
|
6893
6866
|
dispatch
|
|
6894
|
-
} =
|
|
6867
|
+
} = _ref18;
|
|
6895
6868
|
const type = getNodeType(typeOrName, state.schema);
|
|
6896
6869
|
const $pos = tr.selection.$anchor;
|
|
6897
6870
|
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
@@ -6907,11 +6880,11 @@ const deleteNode = typeOrName => _ref19 => {
|
|
|
6907
6880
|
}
|
|
6908
6881
|
return false;
|
|
6909
6882
|
};
|
|
6910
|
-
const deleteRange = range =>
|
|
6883
|
+
const deleteRange = range => _ref19 => {
|
|
6911
6884
|
let {
|
|
6912
6885
|
tr,
|
|
6913
6886
|
dispatch
|
|
6914
|
-
} =
|
|
6887
|
+
} = _ref19;
|
|
6915
6888
|
const {
|
|
6916
6889
|
from,
|
|
6917
6890
|
to
|
|
@@ -6921,24 +6894,24 @@ const deleteRange = range => _ref20 => {
|
|
|
6921
6894
|
}
|
|
6922
6895
|
return true;
|
|
6923
6896
|
};
|
|
6924
|
-
const deleteSelection = () =>
|
|
6897
|
+
const deleteSelection = () => _ref20 => {
|
|
6925
6898
|
let {
|
|
6926
6899
|
state,
|
|
6927
6900
|
dispatch
|
|
6928
|
-
} =
|
|
6901
|
+
} = _ref20;
|
|
6929
6902
|
return deleteSelection$1(state, dispatch);
|
|
6930
6903
|
};
|
|
6931
|
-
const enter = () =>
|
|
6904
|
+
const enter = () => _ref21 => {
|
|
6932
6905
|
let {
|
|
6933
6906
|
commands
|
|
6934
|
-
} =
|
|
6907
|
+
} = _ref21;
|
|
6935
6908
|
return commands.keyboardShortcut('Enter');
|
|
6936
6909
|
};
|
|
6937
|
-
const exitCode = () =>
|
|
6910
|
+
const exitCode = () => _ref22 => {
|
|
6938
6911
|
let {
|
|
6939
6912
|
state,
|
|
6940
6913
|
dispatch
|
|
6941
|
-
} =
|
|
6914
|
+
} = _ref22;
|
|
6942
6915
|
return exitCode$1(state, dispatch);
|
|
6943
6916
|
};
|
|
6944
6917
|
|
|
@@ -7020,12 +6993,12 @@ function getMarkType(nameOrType, schema) {
|
|
|
7020
6993
|
}
|
|
7021
6994
|
const extendMarkRange = function (typeOrName) {
|
|
7022
6995
|
let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7023
|
-
return
|
|
6996
|
+
return _ref23 => {
|
|
7024
6997
|
let {
|
|
7025
6998
|
tr,
|
|
7026
6999
|
state,
|
|
7027
7000
|
dispatch
|
|
7028
|
-
} =
|
|
7001
|
+
} = _ref23;
|
|
7029
7002
|
const type = getMarkType(typeOrName, state.schema);
|
|
7030
7003
|
const {
|
|
7031
7004
|
doc,
|
|
@@ -7092,13 +7065,13 @@ function isiOS() {
|
|
|
7092
7065
|
const focus = function () {
|
|
7093
7066
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
7094
7067
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7095
|
-
return
|
|
7068
|
+
return _ref24 => {
|
|
7096
7069
|
let {
|
|
7097
7070
|
editor,
|
|
7098
7071
|
view,
|
|
7099
7072
|
tr,
|
|
7100
7073
|
dispatch
|
|
7101
|
-
} =
|
|
7074
|
+
} = _ref24;
|
|
7102
7075
|
options = {
|
|
7103
7076
|
scrollIntoView: true,
|
|
7104
7077
|
...options
|
|
@@ -7152,11 +7125,11 @@ const forEach = (items, fn) => props => {
|
|
|
7152
7125
|
index
|
|
7153
7126
|
}));
|
|
7154
7127
|
};
|
|
7155
|
-
const insertContent = (value, options) =>
|
|
7128
|
+
const insertContent = (value, options) => _ref25 => {
|
|
7156
7129
|
let {
|
|
7157
7130
|
tr,
|
|
7158
7131
|
commands
|
|
7159
|
-
} =
|
|
7132
|
+
} = _ref25;
|
|
7160
7133
|
return commands.insertContentAt({
|
|
7161
7134
|
from: tr.selection.from,
|
|
7162
7135
|
to: tr.selection.to
|
|
@@ -7213,12 +7186,12 @@ function selectionToInsertionEnd(tr, startLen, bias) {
|
|
|
7213
7186
|
const isFragment = nodeOrFragment => {
|
|
7214
7187
|
return nodeOrFragment.toString().startsWith('<');
|
|
7215
7188
|
};
|
|
7216
|
-
const insertContentAt = (position, value, options) =>
|
|
7189
|
+
const insertContentAt = (position, value, options) => _ref26 => {
|
|
7217
7190
|
let {
|
|
7218
7191
|
tr,
|
|
7219
7192
|
dispatch,
|
|
7220
7193
|
editor
|
|
7221
|
-
} =
|
|
7194
|
+
} = _ref26;
|
|
7222
7195
|
if (dispatch) {
|
|
7223
7196
|
options = {
|
|
7224
7197
|
parseOptions: {},
|
|
@@ -7241,10 +7214,7 @@ const insertContentAt = (position, value, options) => _ref27 => {
|
|
|
7241
7214
|
} = typeof position === 'number' ? {
|
|
7242
7215
|
from: position,
|
|
7243
7216
|
to: position
|
|
7244
|
-
} :
|
|
7245
|
-
from: position.from,
|
|
7246
|
-
to: position.to
|
|
7247
|
-
};
|
|
7217
|
+
} : position;
|
|
7248
7218
|
let isOnlyTextContent = true;
|
|
7249
7219
|
let isOnlyBlockContent = true;
|
|
7250
7220
|
const nodes = isFragment(content) ? content : [content];
|
|
@@ -7291,74 +7261,34 @@ const insertContentAt = (position, value, options) => _ref27 => {
|
|
|
7291
7261
|
}
|
|
7292
7262
|
return true;
|
|
7293
7263
|
};
|
|
7294
|
-
const joinUp = () =>
|
|
7264
|
+
const joinUp = () => _ref27 => {
|
|
7295
7265
|
let {
|
|
7296
7266
|
state,
|
|
7297
7267
|
dispatch
|
|
7298
|
-
} =
|
|
7268
|
+
} = _ref27;
|
|
7299
7269
|
return joinUp$1(state, dispatch);
|
|
7300
7270
|
};
|
|
7301
|
-
const joinDown = () =>
|
|
7271
|
+
const joinDown = () => _ref28 => {
|
|
7302
7272
|
let {
|
|
7303
7273
|
state,
|
|
7304
7274
|
dispatch
|
|
7305
|
-
} =
|
|
7275
|
+
} = _ref28;
|
|
7306
7276
|
return joinDown$1(state, dispatch);
|
|
7307
7277
|
};
|
|
7308
|
-
const joinBackward = () =>
|
|
7278
|
+
const joinBackward = () => _ref29 => {
|
|
7309
7279
|
let {
|
|
7310
7280
|
state,
|
|
7311
7281
|
dispatch
|
|
7312
|
-
} =
|
|
7282
|
+
} = _ref29;
|
|
7313
7283
|
return joinBackward$1(state, dispatch);
|
|
7314
7284
|
};
|
|
7315
|
-
const joinForward = () =>
|
|
7285
|
+
const joinForward = () => _ref30 => {
|
|
7316
7286
|
let {
|
|
7317
7287
|
state,
|
|
7318
7288
|
dispatch
|
|
7319
|
-
} =
|
|
7289
|
+
} = _ref30;
|
|
7320
7290
|
return joinForward$1(state, dispatch);
|
|
7321
7291
|
};
|
|
7322
|
-
const joinItemBackward = () => _ref32 => {
|
|
7323
|
-
let {
|
|
7324
|
-
tr,
|
|
7325
|
-
state,
|
|
7326
|
-
dispatch
|
|
7327
|
-
} = _ref32;
|
|
7328
|
-
try {
|
|
7329
|
-
const point = joinPoint(state.doc, state.selection.$from.pos, -1);
|
|
7330
|
-
if (point === null || point === undefined) {
|
|
7331
|
-
return false;
|
|
7332
|
-
}
|
|
7333
|
-
tr.join(point, 2);
|
|
7334
|
-
if (dispatch) {
|
|
7335
|
-
dispatch(tr);
|
|
7336
|
-
}
|
|
7337
|
-
return true;
|
|
7338
|
-
} catch {
|
|
7339
|
-
return false;
|
|
7340
|
-
}
|
|
7341
|
-
};
|
|
7342
|
-
const joinItemForward = () => _ref33 => {
|
|
7343
|
-
let {
|
|
7344
|
-
state,
|
|
7345
|
-
dispatch,
|
|
7346
|
-
tr
|
|
7347
|
-
} = _ref33;
|
|
7348
|
-
try {
|
|
7349
|
-
const point = joinPoint(state.doc, state.selection.$from.pos, +1);
|
|
7350
|
-
if (point === null || point === undefined) {
|
|
7351
|
-
return false;
|
|
7352
|
-
}
|
|
7353
|
-
tr.join(point, 2);
|
|
7354
|
-
if (dispatch) {
|
|
7355
|
-
dispatch(tr);
|
|
7356
|
-
}
|
|
7357
|
-
return true;
|
|
7358
|
-
} catch (e) {
|
|
7359
|
-
return false;
|
|
7360
|
-
}
|
|
7361
|
-
};
|
|
7362
7292
|
function isMacOS() {
|
|
7363
7293
|
return typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false;
|
|
7364
7294
|
}
|
|
@@ -7406,13 +7336,13 @@ function normalizeKeyName(name) {
|
|
|
7406
7336
|
}
|
|
7407
7337
|
return result;
|
|
7408
7338
|
}
|
|
7409
|
-
const keyboardShortcut = name =>
|
|
7339
|
+
const keyboardShortcut = name => _ref31 => {
|
|
7410
7340
|
let {
|
|
7411
7341
|
editor,
|
|
7412
7342
|
view,
|
|
7413
7343
|
tr,
|
|
7414
7344
|
dispatch
|
|
7415
|
-
} =
|
|
7345
|
+
} = _ref31;
|
|
7416
7346
|
const keys = normalizeKeyName(name).split(/-(?!$)/);
|
|
7417
7347
|
const key = keys.find(item => !['Alt', 'Ctrl', 'Meta', 'Shift'].includes(item));
|
|
7418
7348
|
const event = new KeyboardEvent('keydown', {
|
|
@@ -7473,11 +7403,11 @@ function isNodeActive(state, typeOrName) {
|
|
|
7473
7403
|
}
|
|
7474
7404
|
const lift = function (typeOrName) {
|
|
7475
7405
|
let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7476
|
-
return
|
|
7406
|
+
return _ref32 => {
|
|
7477
7407
|
let {
|
|
7478
7408
|
state,
|
|
7479
7409
|
dispatch
|
|
7480
|
-
} =
|
|
7410
|
+
} = _ref32;
|
|
7481
7411
|
const type = getNodeType(typeOrName, state.schema);
|
|
7482
7412
|
const isActive = isNodeActive(state, type, attributes);
|
|
7483
7413
|
if (!isActive) {
|
|
@@ -7486,26 +7416,26 @@ const lift = function (typeOrName) {
|
|
|
7486
7416
|
return lift$1(state, dispatch);
|
|
7487
7417
|
};
|
|
7488
7418
|
};
|
|
7489
|
-
const liftEmptyBlock = () =>
|
|
7419
|
+
const liftEmptyBlock = () => _ref33 => {
|
|
7490
7420
|
let {
|
|
7491
7421
|
state,
|
|
7492
7422
|
dispatch
|
|
7493
|
-
} =
|
|
7423
|
+
} = _ref33;
|
|
7494
7424
|
return liftEmptyBlock$1(state, dispatch);
|
|
7495
7425
|
};
|
|
7496
|
-
const liftListItem = typeOrName =>
|
|
7426
|
+
const liftListItem = typeOrName => _ref34 => {
|
|
7497
7427
|
let {
|
|
7498
7428
|
state,
|
|
7499
7429
|
dispatch
|
|
7500
|
-
} =
|
|
7430
|
+
} = _ref34;
|
|
7501
7431
|
const type = getNodeType(typeOrName, state.schema);
|
|
7502
7432
|
return liftListItem$1(type)(state, dispatch);
|
|
7503
7433
|
};
|
|
7504
|
-
const newlineInCode = () =>
|
|
7434
|
+
const newlineInCode = () => _ref35 => {
|
|
7505
7435
|
let {
|
|
7506
7436
|
state,
|
|
7507
7437
|
dispatch
|
|
7508
|
-
} =
|
|
7438
|
+
} = _ref35;
|
|
7509
7439
|
return newlineInCode$1(state, dispatch);
|
|
7510
7440
|
};
|
|
7511
7441
|
function getSchemaTypeNameByName(name, schema) {
|
|
@@ -7532,12 +7462,12 @@ function deleteProps(obj, propOrProps) {
|
|
|
7532
7462
|
return newObj;
|
|
7533
7463
|
}, {});
|
|
7534
7464
|
}
|
|
7535
|
-
const resetAttributes = (typeOrName, attributes) =>
|
|
7465
|
+
const resetAttributes = (typeOrName, attributes) => _ref36 => {
|
|
7536
7466
|
let {
|
|
7537
7467
|
tr,
|
|
7538
7468
|
state,
|
|
7539
7469
|
dispatch
|
|
7540
|
-
} =
|
|
7470
|
+
} = _ref36;
|
|
7541
7471
|
let nodeType = null;
|
|
7542
7472
|
let markType = null;
|
|
7543
7473
|
const schemaType = getSchemaTypeNameByName(typeof typeOrName === 'string' ? typeOrName : typeOrName.name, state.schema);
|
|
@@ -7568,63 +7498,63 @@ const resetAttributes = (typeOrName, attributes) => _ref39 => {
|
|
|
7568
7498
|
}
|
|
7569
7499
|
return true;
|
|
7570
7500
|
};
|
|
7571
|
-
const scrollIntoView = () =>
|
|
7501
|
+
const scrollIntoView = () => _ref37 => {
|
|
7572
7502
|
let {
|
|
7573
7503
|
tr,
|
|
7574
7504
|
dispatch
|
|
7575
|
-
} =
|
|
7505
|
+
} = _ref37;
|
|
7576
7506
|
if (dispatch) {
|
|
7577
7507
|
tr.scrollIntoView();
|
|
7578
7508
|
}
|
|
7579
7509
|
return true;
|
|
7580
7510
|
};
|
|
7581
|
-
const selectAll = () =>
|
|
7511
|
+
const selectAll = () => _ref38 => {
|
|
7582
7512
|
let {
|
|
7583
7513
|
tr,
|
|
7584
7514
|
commands
|
|
7585
|
-
} =
|
|
7515
|
+
} = _ref38;
|
|
7586
7516
|
return commands.setTextSelection({
|
|
7587
7517
|
from: 0,
|
|
7588
7518
|
to: tr.doc.content.size
|
|
7589
7519
|
});
|
|
7590
7520
|
};
|
|
7591
|
-
const selectNodeBackward = () =>
|
|
7521
|
+
const selectNodeBackward = () => _ref39 => {
|
|
7592
7522
|
let {
|
|
7593
7523
|
state,
|
|
7594
7524
|
dispatch
|
|
7595
|
-
} =
|
|
7525
|
+
} = _ref39;
|
|
7596
7526
|
return selectNodeBackward$1(state, dispatch);
|
|
7597
7527
|
};
|
|
7598
|
-
const selectNodeForward = () =>
|
|
7528
|
+
const selectNodeForward = () => _ref40 => {
|
|
7599
7529
|
let {
|
|
7600
7530
|
state,
|
|
7601
7531
|
dispatch
|
|
7602
|
-
} =
|
|
7532
|
+
} = _ref40;
|
|
7603
7533
|
return selectNodeForward$1(state, dispatch);
|
|
7604
7534
|
};
|
|
7605
|
-
const selectParentNode = () =>
|
|
7535
|
+
const selectParentNode = () => _ref41 => {
|
|
7606
7536
|
let {
|
|
7607
7537
|
state,
|
|
7608
7538
|
dispatch
|
|
7609
|
-
} =
|
|
7539
|
+
} = _ref41;
|
|
7610
7540
|
return selectParentNode$1(state, dispatch);
|
|
7611
7541
|
};
|
|
7612
7542
|
|
|
7613
7543
|
// @ts-ignore
|
|
7614
|
-
const selectTextblockEnd = () =>
|
|
7544
|
+
const selectTextblockEnd = () => _ref42 => {
|
|
7615
7545
|
let {
|
|
7616
7546
|
state,
|
|
7617
7547
|
dispatch
|
|
7618
|
-
} =
|
|
7548
|
+
} = _ref42;
|
|
7619
7549
|
return selectTextblockEnd$1(state, dispatch);
|
|
7620
7550
|
};
|
|
7621
7551
|
|
|
7622
7552
|
// @ts-ignore
|
|
7623
|
-
const selectTextblockStart = () =>
|
|
7553
|
+
const selectTextblockStart = () => _ref43 => {
|
|
7624
7554
|
let {
|
|
7625
7555
|
state,
|
|
7626
7556
|
dispatch
|
|
7627
|
-
} =
|
|
7557
|
+
} = _ref43;
|
|
7628
7558
|
return selectTextblockStart$1(state, dispatch);
|
|
7629
7559
|
};
|
|
7630
7560
|
function createDocument(content, schema) {
|
|
@@ -7637,12 +7567,12 @@ function createDocument(content, schema) {
|
|
|
7637
7567
|
const setContent = function (content) {
|
|
7638
7568
|
let emitUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7639
7569
|
let parseOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7640
|
-
return
|
|
7570
|
+
return _ref44 => {
|
|
7641
7571
|
let {
|
|
7642
7572
|
tr,
|
|
7643
7573
|
editor,
|
|
7644
7574
|
dispatch
|
|
7645
|
-
} =
|
|
7575
|
+
} = _ref44;
|
|
7646
7576
|
const {
|
|
7647
7577
|
doc
|
|
7648
7578
|
} = tr;
|
|
@@ -7653,32 +7583,6 @@ const setContent = function (content) {
|
|
|
7653
7583
|
return true;
|
|
7654
7584
|
};
|
|
7655
7585
|
};
|
|
7656
|
-
function getMarkAttributes(state, typeOrName) {
|
|
7657
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
7658
|
-
const {
|
|
7659
|
-
from,
|
|
7660
|
-
to,
|
|
7661
|
-
empty
|
|
7662
|
-
} = state.selection;
|
|
7663
|
-
const marks = [];
|
|
7664
|
-
if (empty) {
|
|
7665
|
-
if (state.storedMarks) {
|
|
7666
|
-
marks.push(...state.storedMarks);
|
|
7667
|
-
}
|
|
7668
|
-
marks.push(...state.selection.$head.marks());
|
|
7669
|
-
} else {
|
|
7670
|
-
state.doc.nodesBetween(from, to, node => {
|
|
7671
|
-
marks.push(...node.marks);
|
|
7672
|
-
});
|
|
7673
|
-
}
|
|
7674
|
-
const mark = marks.find(markItem => markItem.type.name === type.name);
|
|
7675
|
-
if (!mark) {
|
|
7676
|
-
return {};
|
|
7677
|
-
}
|
|
7678
|
-
return {
|
|
7679
|
-
...mark.attrs
|
|
7680
|
-
};
|
|
7681
|
-
}
|
|
7682
7586
|
|
|
7683
7587
|
/**
|
|
7684
7588
|
* Returns a new `Transform` based on all steps of the passed transactions.
|
|
@@ -7758,6 +7662,32 @@ function getText(node, options) {
|
|
|
7758
7662
|
};
|
|
7759
7663
|
return getTextBetween(node, range, options);
|
|
7760
7664
|
}
|
|
7665
|
+
function getMarkAttributes(state, typeOrName) {
|
|
7666
|
+
const type = getMarkType(typeOrName, state.schema);
|
|
7667
|
+
const {
|
|
7668
|
+
from,
|
|
7669
|
+
to,
|
|
7670
|
+
empty
|
|
7671
|
+
} = state.selection;
|
|
7672
|
+
const marks = [];
|
|
7673
|
+
if (empty) {
|
|
7674
|
+
if (state.storedMarks) {
|
|
7675
|
+
marks.push(...state.storedMarks);
|
|
7676
|
+
}
|
|
7677
|
+
marks.push(...state.selection.$head.marks());
|
|
7678
|
+
} else {
|
|
7679
|
+
state.doc.nodesBetween(from, to, node => {
|
|
7680
|
+
marks.push(...node.marks);
|
|
7681
|
+
});
|
|
7682
|
+
}
|
|
7683
|
+
const mark = marks.find(markItem => markItem.type.name === type.name);
|
|
7684
|
+
if (!mark) {
|
|
7685
|
+
return {};
|
|
7686
|
+
}
|
|
7687
|
+
return {
|
|
7688
|
+
...mark.attrs
|
|
7689
|
+
};
|
|
7690
|
+
}
|
|
7761
7691
|
function getNodeAttributes(state, typeOrName) {
|
|
7762
7692
|
const type = getNodeType(typeOrName, state.schema);
|
|
7763
7693
|
const {
|
|
@@ -7848,11 +7778,11 @@ function getChangedRanges(transform) {
|
|
|
7848
7778
|
});
|
|
7849
7779
|
});
|
|
7850
7780
|
}
|
|
7851
|
-
ranges.forEach(
|
|
7781
|
+
ranges.forEach(_ref45 => {
|
|
7852
7782
|
let {
|
|
7853
7783
|
from,
|
|
7854
7784
|
to
|
|
7855
|
-
} =
|
|
7785
|
+
} = _ref45;
|
|
7856
7786
|
const newStart = mapping.slice(index).map(from, -1);
|
|
7857
7787
|
const newEnd = mapping.slice(index).map(to);
|
|
7858
7788
|
const oldStart = mapping.invert().map(newStart, -1);
|
|
@@ -7898,8 +7828,8 @@ function getMarksBetween(from, to, doc) {
|
|
|
7898
7828
|
return marks;
|
|
7899
7829
|
}
|
|
7900
7830
|
function getSplittedAttributes(extensionAttributes, typeName, attributes) {
|
|
7901
|
-
return Object.fromEntries(Object.entries(attributes).filter(
|
|
7902
|
-
let [name] =
|
|
7831
|
+
return Object.fromEntries(Object.entries(attributes).filter(_ref46 => {
|
|
7832
|
+
let [name] = _ref46;
|
|
7903
7833
|
const extensionAttribute = extensionAttributes.find(item => {
|
|
7904
7834
|
return item.type === typeName && item.name === name;
|
|
7905
7835
|
});
|
|
@@ -7928,11 +7858,11 @@ function isMarkActive(state, typeOrName) {
|
|
|
7928
7858
|
}
|
|
7929
7859
|
let selectionRange = 0;
|
|
7930
7860
|
const markRanges = [];
|
|
7931
|
-
ranges.forEach(
|
|
7861
|
+
ranges.forEach(_ref47 => {
|
|
7932
7862
|
let {
|
|
7933
7863
|
$from,
|
|
7934
7864
|
$to
|
|
7935
|
-
} =
|
|
7865
|
+
} = _ref47;
|
|
7936
7866
|
const from = $from.pos;
|
|
7937
7867
|
const to = $to.pos;
|
|
7938
7868
|
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
@@ -8031,11 +7961,11 @@ function canSetMark(state, tr, newMarkType) {
|
|
|
8031
7961
|
const {
|
|
8032
7962
|
ranges
|
|
8033
7963
|
} = selection;
|
|
8034
|
-
return ranges.some(
|
|
7964
|
+
return ranges.some(_ref48 => {
|
|
8035
7965
|
let {
|
|
8036
7966
|
$from,
|
|
8037
7967
|
$to
|
|
8038
|
-
} =
|
|
7968
|
+
} = _ref48;
|
|
8039
7969
|
let someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;
|
|
8040
7970
|
state.doc.nodesBetween($from.pos, $to.pos, (node, _pos, parent) => {
|
|
8041
7971
|
// If we already found a mark that we can enable, return false to bypass the remaining search
|
|
@@ -8054,12 +7984,12 @@ function canSetMark(state, tr, newMarkType) {
|
|
|
8054
7984
|
}
|
|
8055
7985
|
const setMark = function (typeOrName) {
|
|
8056
7986
|
let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8057
|
-
return
|
|
7987
|
+
return _ref49 => {
|
|
8058
7988
|
let {
|
|
8059
7989
|
tr,
|
|
8060
7990
|
state,
|
|
8061
7991
|
dispatch
|
|
8062
|
-
} =
|
|
7992
|
+
} = _ref49;
|
|
8063
7993
|
const {
|
|
8064
7994
|
selection
|
|
8065
7995
|
} = tr;
|
|
@@ -8105,21 +8035,21 @@ const setMark = function (typeOrName) {
|
|
|
8105
8035
|
return canSetMark(state, tr, type);
|
|
8106
8036
|
};
|
|
8107
8037
|
};
|
|
8108
|
-
const setMeta = (key, value) =>
|
|
8038
|
+
const setMeta = (key, value) => _ref50 => {
|
|
8109
8039
|
let {
|
|
8110
8040
|
tr
|
|
8111
|
-
} =
|
|
8041
|
+
} = _ref50;
|
|
8112
8042
|
tr.setMeta(key, value);
|
|
8113
8043
|
return true;
|
|
8114
8044
|
};
|
|
8115
8045
|
const setNode = function (typeOrName) {
|
|
8116
8046
|
let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8117
|
-
return
|
|
8047
|
+
return _ref51 => {
|
|
8118
8048
|
let {
|
|
8119
8049
|
state,
|
|
8120
8050
|
dispatch,
|
|
8121
8051
|
chain
|
|
8122
|
-
} =
|
|
8052
|
+
} = _ref51;
|
|
8123
8053
|
const type = getNodeType(typeOrName, state.schema);
|
|
8124
8054
|
// TODO: use a fallback like insertContent?
|
|
8125
8055
|
if (!type.isTextblock) {
|
|
@@ -8128,28 +8058,28 @@ const setNode = function (typeOrName) {
|
|
|
8128
8058
|
}
|
|
8129
8059
|
return chain()
|
|
8130
8060
|
// try to convert node to default node if needed
|
|
8131
|
-
.command(
|
|
8061
|
+
.command(_ref52 => {
|
|
8132
8062
|
let {
|
|
8133
8063
|
commands
|
|
8134
|
-
} =
|
|
8064
|
+
} = _ref52;
|
|
8135
8065
|
const canSetBlock = setBlockType(type, attributes)(state);
|
|
8136
8066
|
if (canSetBlock) {
|
|
8137
8067
|
return true;
|
|
8138
8068
|
}
|
|
8139
8069
|
return commands.clearNodes();
|
|
8140
|
-
}).command(
|
|
8070
|
+
}).command(_ref53 => {
|
|
8141
8071
|
let {
|
|
8142
8072
|
state: updatedState
|
|
8143
|
-
} =
|
|
8073
|
+
} = _ref53;
|
|
8144
8074
|
return setBlockType(type, attributes)(updatedState, dispatch);
|
|
8145
8075
|
}).run();
|
|
8146
8076
|
};
|
|
8147
8077
|
};
|
|
8148
|
-
const setNodeSelection = position =>
|
|
8078
|
+
const setNodeSelection = position => _ref54 => {
|
|
8149
8079
|
let {
|
|
8150
8080
|
tr,
|
|
8151
8081
|
dispatch
|
|
8152
|
-
} =
|
|
8082
|
+
} = _ref54;
|
|
8153
8083
|
if (dispatch) {
|
|
8154
8084
|
const {
|
|
8155
8085
|
doc
|
|
@@ -8160,11 +8090,11 @@ const setNodeSelection = position => _ref57 => {
|
|
|
8160
8090
|
}
|
|
8161
8091
|
return true;
|
|
8162
8092
|
};
|
|
8163
|
-
const setTextSelection = position =>
|
|
8093
|
+
const setTextSelection = position => _ref55 => {
|
|
8164
8094
|
let {
|
|
8165
8095
|
tr,
|
|
8166
8096
|
dispatch
|
|
8167
|
-
} =
|
|
8097
|
+
} = _ref55;
|
|
8168
8098
|
if (dispatch) {
|
|
8169
8099
|
const {
|
|
8170
8100
|
doc
|
|
@@ -8185,11 +8115,11 @@ const setTextSelection = position => _ref58 => {
|
|
|
8185
8115
|
}
|
|
8186
8116
|
return true;
|
|
8187
8117
|
};
|
|
8188
|
-
const sinkListItem = typeOrName =>
|
|
8118
|
+
const sinkListItem = typeOrName => _ref56 => {
|
|
8189
8119
|
let {
|
|
8190
8120
|
state,
|
|
8191
8121
|
dispatch
|
|
8192
|
-
} =
|
|
8122
|
+
} = _ref56;
|
|
8193
8123
|
const type = getNodeType(typeOrName, state.schema);
|
|
8194
8124
|
return sinkListItem$1(type)(state, dispatch);
|
|
8195
8125
|
};
|
|
@@ -8204,13 +8134,13 @@ const splitBlock = function () {
|
|
|
8204
8134
|
let {
|
|
8205
8135
|
keepMarks = true
|
|
8206
8136
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8207
|
-
return
|
|
8137
|
+
return _ref57 => {
|
|
8208
8138
|
let {
|
|
8209
8139
|
tr,
|
|
8210
8140
|
state,
|
|
8211
8141
|
dispatch,
|
|
8212
8142
|
editor
|
|
8213
|
-
} =
|
|
8143
|
+
} = _ref57;
|
|
8214
8144
|
const {
|
|
8215
8145
|
selection,
|
|
8216
8146
|
doc
|
|
@@ -8274,13 +8204,13 @@ const splitBlock = function () {
|
|
|
8274
8204
|
return true;
|
|
8275
8205
|
};
|
|
8276
8206
|
};
|
|
8277
|
-
const splitListItem = typeOrName =>
|
|
8207
|
+
const splitListItem = typeOrName => _ref58 => {
|
|
8278
8208
|
let {
|
|
8279
8209
|
tr,
|
|
8280
8210
|
state,
|
|
8281
8211
|
dispatch,
|
|
8282
8212
|
editor
|
|
8283
|
-
} =
|
|
8213
|
+
} = _ref58;
|
|
8284
8214
|
var _a;
|
|
8285
8215
|
const type = getNodeType(typeOrName, state.schema);
|
|
8286
8216
|
const {
|
|
@@ -8409,7 +8339,7 @@ const joinListForwards = (tr, listType) => {
|
|
|
8409
8339
|
};
|
|
8410
8340
|
const toggleList = function (listTypeOrName, itemTypeOrName, keepMarks) {
|
|
8411
8341
|
let attributes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
8412
|
-
return
|
|
8342
|
+
return _ref59 => {
|
|
8413
8343
|
let {
|
|
8414
8344
|
editor,
|
|
8415
8345
|
tr,
|
|
@@ -8418,7 +8348,7 @@ const toggleList = function (listTypeOrName, itemTypeOrName, keepMarks) {
|
|
|
8418
8348
|
chain,
|
|
8419
8349
|
commands,
|
|
8420
8350
|
can
|
|
8421
|
-
} =
|
|
8351
|
+
} = _ref59;
|
|
8422
8352
|
const {
|
|
8423
8353
|
extensions,
|
|
8424
8354
|
splittableMarks
|
|
@@ -8479,11 +8409,11 @@ const toggleList = function (listTypeOrName, itemTypeOrName, keepMarks) {
|
|
|
8479
8409
|
const toggleMark = function (typeOrName) {
|
|
8480
8410
|
let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8481
8411
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
8482
|
-
return
|
|
8412
|
+
return _ref60 => {
|
|
8483
8413
|
let {
|
|
8484
8414
|
state,
|
|
8485
8415
|
commands
|
|
8486
|
-
} =
|
|
8416
|
+
} = _ref60;
|
|
8487
8417
|
const {
|
|
8488
8418
|
extendEmptyMarkRange = false
|
|
8489
8419
|
} = options;
|
|
@@ -8499,11 +8429,11 @@ const toggleMark = function (typeOrName) {
|
|
|
8499
8429
|
};
|
|
8500
8430
|
const toggleNode = function (typeOrName, toggleTypeOrName) {
|
|
8501
8431
|
let attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
8502
|
-
return
|
|
8432
|
+
return _ref61 => {
|
|
8503
8433
|
let {
|
|
8504
8434
|
state,
|
|
8505
8435
|
commands
|
|
8506
|
-
} =
|
|
8436
|
+
} = _ref61;
|
|
8507
8437
|
const type = getNodeType(typeOrName, state.schema);
|
|
8508
8438
|
const toggleType = getNodeType(toggleTypeOrName, state.schema);
|
|
8509
8439
|
const isActive = isNodeActive(state, type, attributes);
|
|
@@ -8515,11 +8445,11 @@ const toggleNode = function (typeOrName, toggleTypeOrName) {
|
|
|
8515
8445
|
};
|
|
8516
8446
|
const toggleWrap = function (typeOrName) {
|
|
8517
8447
|
let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8518
|
-
return
|
|
8448
|
+
return _ref62 => {
|
|
8519
8449
|
let {
|
|
8520
8450
|
state,
|
|
8521
8451
|
commands
|
|
8522
|
-
} =
|
|
8452
|
+
} = _ref62;
|
|
8523
8453
|
const type = getNodeType(typeOrName, state.schema);
|
|
8524
8454
|
const isActive = isNodeActive(state, type, attributes);
|
|
8525
8455
|
if (isActive) {
|
|
@@ -8528,11 +8458,11 @@ const toggleWrap = function (typeOrName) {
|
|
|
8528
8458
|
return commands.wrapIn(type, attributes);
|
|
8529
8459
|
};
|
|
8530
8460
|
};
|
|
8531
|
-
const undoInputRule = () =>
|
|
8461
|
+
const undoInputRule = () => _ref63 => {
|
|
8532
8462
|
let {
|
|
8533
8463
|
state,
|
|
8534
8464
|
dispatch
|
|
8535
|
-
} =
|
|
8465
|
+
} = _ref63;
|
|
8536
8466
|
const plugins = state.plugins;
|
|
8537
8467
|
for (let i = 0; i < plugins.length; i += 1) {
|
|
8538
8468
|
const plugin = plugins[i];
|
|
@@ -8558,11 +8488,11 @@ const undoInputRule = () => _ref66 => {
|
|
|
8558
8488
|
}
|
|
8559
8489
|
return false;
|
|
8560
8490
|
};
|
|
8561
|
-
const unsetAllMarks = () =>
|
|
8491
|
+
const unsetAllMarks = () => _ref64 => {
|
|
8562
8492
|
let {
|
|
8563
8493
|
tr,
|
|
8564
8494
|
dispatch
|
|
8565
|
-
} =
|
|
8495
|
+
} = _ref64;
|
|
8566
8496
|
const {
|
|
8567
8497
|
selection
|
|
8568
8498
|
} = tr;
|
|
@@ -8582,12 +8512,12 @@ const unsetAllMarks = () => _ref67 => {
|
|
|
8582
8512
|
};
|
|
8583
8513
|
const unsetMark = function (typeOrName) {
|
|
8584
8514
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8585
|
-
return
|
|
8515
|
+
return _ref65 => {
|
|
8586
8516
|
let {
|
|
8587
8517
|
tr,
|
|
8588
8518
|
state,
|
|
8589
8519
|
dispatch
|
|
8590
|
-
} =
|
|
8520
|
+
} = _ref65;
|
|
8591
8521
|
var _a;
|
|
8592
8522
|
const {
|
|
8593
8523
|
extendEmptyMarkRange = false
|
|
@@ -8627,12 +8557,12 @@ const unsetMark = function (typeOrName) {
|
|
|
8627
8557
|
};
|
|
8628
8558
|
const updateAttributes = function (typeOrName) {
|
|
8629
8559
|
let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8630
|
-
return
|
|
8560
|
+
return _ref66 => {
|
|
8631
8561
|
let {
|
|
8632
8562
|
tr,
|
|
8633
8563
|
state,
|
|
8634
8564
|
dispatch
|
|
8635
|
-
} =
|
|
8565
|
+
} = _ref66;
|
|
8636
8566
|
let nodeType = null;
|
|
8637
8567
|
let markType = null;
|
|
8638
8568
|
const schemaType = getSchemaTypeNameByName(typeof typeOrName === 'string' ? typeOrName : typeOrName.name, state.schema);
|
|
@@ -8676,22 +8606,22 @@ const updateAttributes = function (typeOrName) {
|
|
|
8676
8606
|
};
|
|
8677
8607
|
const wrapIn = function (typeOrName) {
|
|
8678
8608
|
let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8679
|
-
return
|
|
8609
|
+
return _ref67 => {
|
|
8680
8610
|
let {
|
|
8681
8611
|
state,
|
|
8682
8612
|
dispatch
|
|
8683
|
-
} =
|
|
8613
|
+
} = _ref67;
|
|
8684
8614
|
const type = getNodeType(typeOrName, state.schema);
|
|
8685
8615
|
return wrapIn$1(type, attributes)(state, dispatch);
|
|
8686
8616
|
};
|
|
8687
8617
|
};
|
|
8688
8618
|
const wrapInList = function (typeOrName) {
|
|
8689
8619
|
let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8690
|
-
return
|
|
8620
|
+
return _ref68 => {
|
|
8691
8621
|
let {
|
|
8692
8622
|
state,
|
|
8693
8623
|
dispatch
|
|
8694
|
-
} =
|
|
8624
|
+
} = _ref68;
|
|
8695
8625
|
const type = getNodeType(typeOrName, state.schema);
|
|
8696
8626
|
return wrapInList$1(type, attributes)(state, dispatch);
|
|
8697
8627
|
};
|
|
@@ -8703,7 +8633,6 @@ var commands = /*#__PURE__*/Object.freeze({
|
|
|
8703
8633
|
clearNodes: clearNodes,
|
|
8704
8634
|
command: command,
|
|
8705
8635
|
createParagraphNear: createParagraphNear,
|
|
8706
|
-
cut: cut,
|
|
8707
8636
|
deleteCurrentNode: deleteCurrentNode,
|
|
8708
8637
|
deleteNode: deleteNode,
|
|
8709
8638
|
deleteRange: deleteRange,
|
|
@@ -8720,8 +8649,6 @@ var commands = /*#__PURE__*/Object.freeze({
|
|
|
8720
8649
|
joinDown: joinDown,
|
|
8721
8650
|
joinBackward: joinBackward,
|
|
8722
8651
|
joinForward: joinForward,
|
|
8723
|
-
joinItemBackward: joinItemBackward,
|
|
8724
|
-
joinItemForward: joinItemForward,
|
|
8725
8652
|
keyboardShortcut: keyboardShortcut,
|
|
8726
8653
|
lift: lift,
|
|
8727
8654
|
liftEmptyBlock: liftEmptyBlock,
|
|
@@ -8808,16 +8735,16 @@ const FocusEvents = Extension.create({
|
|
|
8808
8735
|
const Keymap = Extension.create({
|
|
8809
8736
|
name: 'keymap',
|
|
8810
8737
|
addKeyboardShortcuts() {
|
|
8811
|
-
const handleBackspace = () => this.editor.commands.first(
|
|
8738
|
+
const handleBackspace = () => this.editor.commands.first(_ref69 => {
|
|
8812
8739
|
let {
|
|
8813
8740
|
commands
|
|
8814
|
-
} =
|
|
8741
|
+
} = _ref69;
|
|
8815
8742
|
return [() => commands.undoInputRule(),
|
|
8816
8743
|
// maybe convert first text block node to default node
|
|
8817
|
-
() => commands.command(
|
|
8744
|
+
() => commands.command(_ref70 => {
|
|
8818
8745
|
let {
|
|
8819
8746
|
tr
|
|
8820
|
-
} =
|
|
8747
|
+
} = _ref70;
|
|
8821
8748
|
const {
|
|
8822
8749
|
selection,
|
|
8823
8750
|
doc
|
|
@@ -8830,26 +8757,23 @@ const Keymap = Extension.create({
|
|
|
8830
8757
|
pos,
|
|
8831
8758
|
parent
|
|
8832
8759
|
} = $anchor;
|
|
8833
|
-
const
|
|
8834
|
-
const parentIsIsolating = $parentPos.parent.type.spec.isolating;
|
|
8835
|
-
const parentPos = $anchor.pos - $anchor.parentOffset;
|
|
8836
|
-
const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc).from === pos;
|
|
8760
|
+
const isAtStart = Selection.atStart(doc).from === pos;
|
|
8837
8761
|
if (!empty || !isAtStart || !parent.type.isTextblock || parent.textContent.length) {
|
|
8838
8762
|
return false;
|
|
8839
8763
|
}
|
|
8840
8764
|
return commands.clearNodes();
|
|
8841
8765
|
}), () => commands.deleteSelection(), () => commands.joinBackward(), () => commands.selectNodeBackward()];
|
|
8842
8766
|
});
|
|
8843
|
-
const handleDelete = () => this.editor.commands.first(
|
|
8767
|
+
const handleDelete = () => this.editor.commands.first(_ref71 => {
|
|
8844
8768
|
let {
|
|
8845
8769
|
commands
|
|
8846
|
-
} =
|
|
8770
|
+
} = _ref71;
|
|
8847
8771
|
return [() => commands.deleteSelection(), () => commands.deleteCurrentNode(), () => commands.joinForward(), () => commands.selectNodeForward()];
|
|
8848
8772
|
});
|
|
8849
|
-
const handleEnter = () => this.editor.commands.first(
|
|
8773
|
+
const handleEnter = () => this.editor.commands.first(_ref72 => {
|
|
8850
8774
|
let {
|
|
8851
8775
|
commands
|
|
8852
|
-
} =
|
|
8776
|
+
} = _ref72;
|
|
8853
8777
|
return [() => commands.newlineInCode(), () => commands.createParagraphNear(), () => commands.liftEmptyBlock(), () => commands.splitBlock()];
|
|
8854
8778
|
});
|
|
8855
8779
|
const baseKeymap = {
|
|
@@ -9027,8 +8951,8 @@ img.ProseMirror-separator {
|
|
|
9027
8951
|
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
9028
8952
|
opacity: 0
|
|
9029
8953
|
}`;
|
|
9030
|
-
function createStyleTag(style, nonce
|
|
9031
|
-
const tiptapStyleTag = document.querySelector(
|
|
8954
|
+
function createStyleTag(style, nonce) {
|
|
8955
|
+
const tiptapStyleTag = document.querySelector('style[data-tiptap-style]');
|
|
9032
8956
|
if (tiptapStyleTag !== null) {
|
|
9033
8957
|
return tiptapStyleTag;
|
|
9034
8958
|
}
|
|
@@ -9036,7 +8960,7 @@ function createStyleTag(style, nonce, suffix) {
|
|
|
9036
8960
|
if (nonce) {
|
|
9037
8961
|
styleNode.setAttribute('nonce', nonce);
|
|
9038
8962
|
}
|
|
9039
|
-
styleNode.setAttribute(
|
|
8963
|
+
styleNode.setAttribute('data-tiptap-style', '');
|
|
9040
8964
|
styleNode.innerHTML = style;
|
|
9041
8965
|
document.getElementsByTagName('head')[0].appendChild(styleNode);
|
|
9042
8966
|
return styleNode;
|
|
@@ -9254,7 +9178,6 @@ class Editor extends EventEmitter {
|
|
|
9254
9178
|
});
|
|
9255
9179
|
this.view.updateState(newState);
|
|
9256
9180
|
this.createNodeViews();
|
|
9257
|
-
this.prependClass();
|
|
9258
9181
|
// Let’s store the editor instance in the DOM element.
|
|
9259
9182
|
// So we’ll have access to it for tests.
|
|
9260
9183
|
const dom = this.view.dom;
|
|
@@ -9268,12 +9191,6 @@ class Editor extends EventEmitter {
|
|
|
9268
9191
|
nodeViews: this.extensionManager.nodeViews
|
|
9269
9192
|
});
|
|
9270
9193
|
}
|
|
9271
|
-
/**
|
|
9272
|
-
* Prepend class name to element.
|
|
9273
|
-
*/
|
|
9274
|
-
prependClass() {
|
|
9275
|
-
this.view.dom.className = `tiptap ${this.view.dom.className}`;
|
|
9276
|
-
}
|
|
9277
9194
|
captureTransaction(fn) {
|
|
9278
9195
|
this.isCapturingTransaction = true;
|
|
9279
9196
|
fn();
|
|
@@ -9422,12 +9339,12 @@ class Editor extends EventEmitter {
|
|
|
9422
9339
|
function markInputRule(config) {
|
|
9423
9340
|
return new InputRule({
|
|
9424
9341
|
find: config.find,
|
|
9425
|
-
handler:
|
|
9342
|
+
handler: _ref73 => {
|
|
9426
9343
|
let {
|
|
9427
9344
|
state,
|
|
9428
9345
|
range,
|
|
9429
9346
|
match
|
|
9430
|
-
} =
|
|
9347
|
+
} = _ref73;
|
|
9431
9348
|
const attributes = callOrReturn(config.getAttributes, undefined, match);
|
|
9432
9349
|
if (attributes === false || attributes === null) {
|
|
9433
9350
|
return null;
|
|
@@ -9437,6 +9354,7 @@ function markInputRule(config) {
|
|
|
9437
9354
|
} = state;
|
|
9438
9355
|
const captureGroup = match[match.length - 1];
|
|
9439
9356
|
const fullMatch = match[0];
|
|
9357
|
+
let markEnd = range.to;
|
|
9440
9358
|
if (captureGroup) {
|
|
9441
9359
|
const startSpaces = fullMatch.search(/\S/);
|
|
9442
9360
|
const textStart = range.from + fullMatch.indexOf(captureGroup);
|
|
@@ -9455,7 +9373,7 @@ function markInputRule(config) {
|
|
|
9455
9373
|
if (textStart > range.from) {
|
|
9456
9374
|
tr.delete(range.from + startSpaces, textStart);
|
|
9457
9375
|
}
|
|
9458
|
-
|
|
9376
|
+
markEnd = range.from + startSpaces + captureGroup.length;
|
|
9459
9377
|
tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
|
|
9460
9378
|
tr.removeStoredMark(config.type);
|
|
9461
9379
|
}
|
|
@@ -9470,19 +9388,18 @@ function markInputRule(config) {
|
|
|
9470
9388
|
function nodeInputRule(config) {
|
|
9471
9389
|
return new InputRule({
|
|
9472
9390
|
find: config.find,
|
|
9473
|
-
handler:
|
|
9391
|
+
handler: _ref74 => {
|
|
9474
9392
|
let {
|
|
9475
9393
|
state,
|
|
9476
9394
|
range,
|
|
9477
9395
|
match
|
|
9478
|
-
} =
|
|
9396
|
+
} = _ref74;
|
|
9479
9397
|
const attributes = callOrReturn(config.getAttributes, undefined, match) || {};
|
|
9480
9398
|
const {
|
|
9481
9399
|
tr
|
|
9482
9400
|
} = state;
|
|
9483
9401
|
const start = range.from;
|
|
9484
9402
|
let end = range.to;
|
|
9485
|
-
const newNode = config.type.create(attributes);
|
|
9486
9403
|
if (match[1]) {
|
|
9487
9404
|
const offset = match[0].lastIndexOf(match[1]);
|
|
9488
9405
|
let matchStart = start + offset;
|
|
@@ -9495,11 +9412,10 @@ function nodeInputRule(config) {
|
|
|
9495
9412
|
const lastChar = match[0][match[0].length - 1];
|
|
9496
9413
|
tr.insertText(lastChar, start + match[0].length - 1);
|
|
9497
9414
|
// insert node from input rule
|
|
9498
|
-
tr.replaceWith(matchStart, end,
|
|
9415
|
+
tr.replaceWith(matchStart, end, config.type.create(attributes));
|
|
9499
9416
|
} else if (match[0]) {
|
|
9500
|
-
tr.
|
|
9417
|
+
tr.replaceWith(start, end, config.type.create(attributes));
|
|
9501
9418
|
}
|
|
9502
|
-
tr.scrollIntoView();
|
|
9503
9419
|
}
|
|
9504
9420
|
});
|
|
9505
9421
|
}
|
|
@@ -9513,12 +9429,12 @@ function nodeInputRule(config) {
|
|
|
9513
9429
|
function textblockTypeInputRule(config) {
|
|
9514
9430
|
return new InputRule({
|
|
9515
9431
|
find: config.find,
|
|
9516
|
-
handler:
|
|
9432
|
+
handler: _ref75 => {
|
|
9517
9433
|
let {
|
|
9518
9434
|
state,
|
|
9519
9435
|
range,
|
|
9520
9436
|
match
|
|
9521
|
-
} =
|
|
9437
|
+
} = _ref75;
|
|
9522
9438
|
const $start = state.doc.resolve(range.from);
|
|
9523
9439
|
const attributes = callOrReturn(config.getAttributes, undefined, match) || {};
|
|
9524
9440
|
if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), config.type)) {
|
|
@@ -9546,13 +9462,13 @@ function textblockTypeInputRule(config) {
|
|
|
9546
9462
|
function wrappingInputRule(config) {
|
|
9547
9463
|
return new InputRule({
|
|
9548
9464
|
find: config.find,
|
|
9549
|
-
handler:
|
|
9465
|
+
handler: _ref77 => {
|
|
9550
9466
|
let {
|
|
9551
9467
|
state,
|
|
9552
9468
|
range,
|
|
9553
9469
|
match,
|
|
9554
9470
|
chain
|
|
9555
|
-
} =
|
|
9471
|
+
} = _ref77;
|
|
9556
9472
|
const attributes = callOrReturn(config.getAttributes, undefined, match) || {};
|
|
9557
9473
|
const tr = state.tr.delete(range.from, range.to);
|
|
9558
9474
|
const $start = tr.doc.resolve(range.from);
|
|
@@ -9653,11 +9569,11 @@ class Mark {
|
|
|
9653
9569
|
}));
|
|
9654
9570
|
return extension;
|
|
9655
9571
|
}
|
|
9656
|
-
static handleExit(
|
|
9572
|
+
static handleExit(_ref78) {
|
|
9657
9573
|
let {
|
|
9658
9574
|
editor,
|
|
9659
9575
|
mark
|
|
9660
|
-
} =
|
|
9576
|
+
} = _ref78;
|
|
9661
9577
|
const {
|
|
9662
9578
|
tr
|
|
9663
9579
|
} = editor.state;
|
|
@@ -9754,14 +9670,13 @@ class Node {
|
|
|
9754
9670
|
function markPasteRule(config) {
|
|
9755
9671
|
return new PasteRule({
|
|
9756
9672
|
find: config.find,
|
|
9757
|
-
handler:
|
|
9673
|
+
handler: _ref80 => {
|
|
9758
9674
|
let {
|
|
9759
9675
|
state,
|
|
9760
9676
|
range,
|
|
9761
|
-
match
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
const attributes = callOrReturn(config.getAttributes, undefined, match, pasteEvent);
|
|
9677
|
+
match
|
|
9678
|
+
} = _ref80;
|
|
9679
|
+
const attributes = callOrReturn(config.getAttributes, undefined, match);
|
|
9765
9680
|
if (attributes === false || attributes === null) {
|
|
9766
9681
|
return null;
|
|
9767
9682
|
}
|
|
@@ -9797,4 +9712,4 @@ function markPasteRule(config) {
|
|
|
9797
9712
|
});
|
|
9798
9713
|
}
|
|
9799
9714
|
|
|
9800
|
-
export { Decoration as D, Extension as E, Mark as M, Node as N, DecorationSet as a, markInputRule as b, markPasteRule as c, callOrReturn as d, Editor as e, getMarkAttributes as f, getExtensionField as g, combineTransactionSteps as h,
|
|
9715
|
+
export { Decoration as D, Extension as E, Mark as M, Node as N, DecorationSet as a, markInputRule as b, markPasteRule as c, callOrReturn as d, Editor as e, getMarkAttributes as f, getExtensionField as g, combineTransactionSteps as h, getChangedRanges as i, getMarksBetween as j, keydownHandler as k, findChildrenInRange as l, mergeAttributes as m, nodeInputRule as n, getAttributes as o, textblockTypeInputRule as t, wrappingInputRule as w };
|