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