@titaui/pc 1.10.39 → 1.10.43
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/lib/components/dynamic/dynamic-item/dynamic-chart/index.js +18 -3
- package/lib/components/upload/index.js +2 -4
- package/lib/index.js +0 -8
- package/package.json +2 -20
- package/lib/components/rich-editor/basic/schema.js +0 -47
- package/lib/components/rich-editor/consts/events.js +0 -12
- package/lib/components/rich-editor/enums.js +0 -42
- package/lib/components/rich-editor/index.js +0 -58
- package/lib/components/rich-editor/keymap.js +0 -119
- package/lib/components/rich-editor/keymaps/index.js +0 -241
- package/lib/components/rich-editor/models/controller.js +0 -18
- package/lib/components/rich-editor/models/editor.js +0 -47
- package/lib/components/rich-editor/models/plugin.js +0 -20
- package/lib/components/rich-editor/models/schema.js +0 -121
- package/lib/components/rich-editor/plugins/block/block-quote/commond.js +0 -27
- package/lib/components/rich-editor/plugins/block/block-quote/index.js +0 -126
- package/lib/components/rich-editor/plugins/block/heading/commonds.js +0 -31
- package/lib/components/rich-editor/plugins/block/heading/index.js +0 -188
- package/lib/components/rich-editor/plugins/block/index.js +0 -57
- package/lib/components/rich-editor/plugins/block/lists/actions/conversions.js +0 -172
- package/lib/components/rich-editor/plugins/block/lists/actions/indent-list-items-selected.js +0 -163
- package/lib/components/rich-editor/plugins/block/lists/actions/indent-list.js +0 -59
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-forward.js +0 -74
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/index.js +0 -45
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +0 -104
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +0 -92
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +0 -89
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-paragraph-with-list.js +0 -48
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-sibling-list-items.js +0 -61
- package/lib/components/rich-editor/plugins/block/lists/actions/merge-lists.js +0 -34
- package/lib/components/rich-editor/plugins/block/lists/actions/outdent-list-items-selected.js +0 -289
- package/lib/components/rich-editor/plugins/block/lists/actions/wrap-and-join-lists.js +0 -180
- package/lib/components/rich-editor/plugins/block/lists/baseCommand.js +0 -328
- package/lib/components/rich-editor/plugins/block/lists/commond/indent-list.js +0 -60
- package/lib/components/rich-editor/plugins/block/lists/commond/index.js +0 -398
- package/lib/components/rich-editor/plugins/block/lists/commond/join-list-item-forward.js +0 -45
- package/lib/components/rich-editor/plugins/block/lists/commond/listBackspace.js +0 -302
- package/lib/components/rich-editor/plugins/block/lists/commond/outdent-list.js +0 -43
- package/lib/components/rich-editor/plugins/block/lists/index.js +0 -222
- package/lib/components/rich-editor/plugins/block/lists/messages.js +0 -38
- package/lib/components/rich-editor/plugins/block/lists/pm-plugins/input-rule.js +0 -152
- package/lib/components/rich-editor/plugins/block/lists/pm-plugins/keymap.js +0 -33
- package/lib/components/rich-editor/plugins/block/lists/pm-plugins/main.js +0 -94
- package/lib/components/rich-editor/plugins/block/lists/styles.js +0 -15
- package/lib/components/rich-editor/plugins/block/lists/transforms.js +0 -347
- package/lib/components/rich-editor/plugins/block/lists/utils/analytics.js +0 -48
- package/lib/components/rich-editor/plugins/block/lists/utils/find.js +0 -126
- package/lib/components/rich-editor/plugins/block/lists/utils/indentation.js +0 -87
- package/lib/components/rich-editor/plugins/block/lists/utils/node.js +0 -144
- package/lib/components/rich-editor/plugins/block/lists/utils/replace-content.js +0 -31
- package/lib/components/rich-editor/plugins/block/lists/utils/selection.js +0 -201
- package/lib/components/rich-editor/plugins/block/lists/utils.js +0 -52
- package/lib/components/rich-editor/plugins/block/paragraph/index.js +0 -91
- package/lib/components/rich-editor/plugins/core/index.js +0 -90
- package/lib/components/rich-editor/plugins/core/pm-plugins/focus-handler.js +0 -67
- package/lib/components/rich-editor/plugins/core/pm-plugins/keymap.js +0 -29
- package/lib/components/rich-editor/plugins/core/pm-plugins/reactNodeView.js +0 -80
- package/lib/components/rich-editor/plugins/extension/alignment/commond.js +0 -24
- package/lib/components/rich-editor/plugins/extension/alignment/index.js +0 -111
- package/lib/components/rich-editor/plugins/extension/alignment/utils.js +0 -19
- package/lib/components/rich-editor/plugins/extension/index.js +0 -18
- package/lib/components/rich-editor/plugins/index.js +0 -44
- package/lib/components/rich-editor/plugins/inline/color/commond.js +0 -128
- package/lib/components/rich-editor/plugins/inline/color/consts.js +0 -43
- package/lib/components/rich-editor/plugins/inline/color/index.css +0 -61
- package/lib/components/rich-editor/plugins/inline/color/index.js +0 -209
- package/lib/components/rich-editor/plugins/inline/color/selector.js +0 -252
- package/lib/components/rich-editor/plugins/inline/delete-line/index.js +0 -147
- package/lib/components/rich-editor/plugins/inline/em/index.js +0 -93
- package/lib/components/rich-editor/plugins/inline/index.js +0 -83
- package/lib/components/rich-editor/plugins/inline/link/commands.js +0 -256
- package/lib/components/rich-editor/plugins/inline/link/index.js +0 -149
- package/lib/components/rich-editor/plugins/inline/link/pm-plugins/fake-cursor-for-toolbar.js +0 -77
- package/lib/components/rich-editor/plugins/inline/link/pm-plugins/main.js +0 -293
- package/lib/components/rich-editor/plugins/inline/link/ui/index.css +0 -79
- package/lib/components/rich-editor/plugins/inline/link/ui/linkEditor.js +0 -148
- package/lib/components/rich-editor/plugins/inline/link/ui/linkToolbar.js +0 -88
- package/lib/components/rich-editor/plugins/inline/link/ui/toolbarBtn.js +0 -117
- package/lib/components/rich-editor/plugins/inline/link/utils.js +0 -33
- package/lib/components/rich-editor/plugins/inline/strong/index.js +0 -137
- package/lib/components/rich-editor/plugins/inline/under-line/index.js +0 -145
- package/lib/components/rich-editor/plugins/util.js +0 -281
- package/lib/components/rich-editor/react/reactNodeView.js +0 -383
- package/lib/components/rich-editor/react/uiProvider.js +0 -185
- package/lib/components/rich-editor/schemas/basic.js +0 -309
- package/lib/components/rich-editor/schemas/index.js +0 -19
- package/lib/components/rich-editor/schemas/list.js +0 -342
- package/lib/components/rich-editor/types/commond.js +0 -5
- package/lib/components/rich-editor/types/index.js +0 -18
- package/lib/components/rich-editor/ui/Popup/index.js +0 -247
- package/lib/components/rich-editor/ui/Popup/utils.js +0 -399
- package/lib/components/rich-editor/ui/editor/index.css +0 -141
- package/lib/components/rich-editor/ui/editor/index.js +0 -130
- package/lib/components/rich-editor/ui/normal-toolbar/index.css +0 -28
- package/lib/components/rich-editor/ui/normal-toolbar/index.js +0 -109
- package/lib/components/rich-editor/utils/browser.js +0 -35
- package/lib/components/rich-editor/utils/commands.js +0 -266
- package/lib/components/rich-editor/utils/document.js +0 -160
- package/lib/components/rich-editor/utils/event.js +0 -79
- package/lib/components/rich-editor/utils/helpers.js +0 -16
- package/lib/components/rich-editor/utils/mark.js +0 -168
- package/lib/components/rich-editor/utils/slice.js +0 -85
- package/lib/components/rich-editor/utils/toolbar.js +0 -228
- package/yarn-error.log +0 -22184
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.editInsertedLink = editInsertedLink;
|
|
7
|
-
exports.hideLinkToolbar = hideLinkToolbar;
|
|
8
|
-
exports.insertLink = insertLink;
|
|
9
|
-
exports.isLinkAtPos = isLinkAtPos;
|
|
10
|
-
exports.isTextAtPos = isTextAtPos;
|
|
11
|
-
exports.removeLink = removeLink;
|
|
12
|
-
exports.setLinkHref = setLinkHref;
|
|
13
|
-
exports.setLinkText = setLinkText;
|
|
14
|
-
exports.updateLink = updateLink;
|
|
15
|
-
|
|
16
|
-
var _utils = require("./utils");
|
|
17
|
-
|
|
18
|
-
var _main = require("./pm-plugins/main");
|
|
19
|
-
|
|
20
|
-
var _prosemirrorState = require("prosemirror-state");
|
|
21
|
-
|
|
22
|
-
var _commands = require("../../../utils/commands");
|
|
23
|
-
|
|
24
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
-
|
|
26
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
27
|
-
|
|
28
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
29
|
-
|
|
30
|
-
// import {
|
|
31
|
-
// addAnalytics,
|
|
32
|
-
// ACTION,
|
|
33
|
-
// ACTION_SUBJECT,
|
|
34
|
-
// INPUT_METHOD,
|
|
35
|
-
// EVENT_TYPE,
|
|
36
|
-
// ACTION_SUBJECT_ID,
|
|
37
|
-
// withAnalytics,
|
|
38
|
-
// } from '../analytics';
|
|
39
|
-
// import { queueCardsFromChangedTr } from '../card/pm-plugins/doc';
|
|
40
|
-
// import { LinkInputType } from './ui/HyperlinkAddToolbar/HyperlinkAddToolbar';
|
|
41
|
-
// import { getLinkCreationAnalyticsEvent } from './analytics';
|
|
42
|
-
function isTextAtPos(pos) {
|
|
43
|
-
return function (state) {
|
|
44
|
-
var node = state.doc.nodeAt(pos);
|
|
45
|
-
return !!node && node.isText;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function isLinkAtPos(pos) {
|
|
50
|
-
return function (state) {
|
|
51
|
-
var node = state.doc.nodeAt(pos);
|
|
52
|
-
return !!node && state.schema.marks.link.isInSet(node.marks);
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function setLinkHref(href, pos, to, isTabPressed) {
|
|
57
|
-
return (0, _commands.filter)(isTextAtPos(pos), function (state, dispatch) {
|
|
58
|
-
var $pos = state.doc.resolve(pos);
|
|
59
|
-
var node = state.doc.nodeAt(pos);
|
|
60
|
-
var linkMark = state.schema.marks.link;
|
|
61
|
-
var mark = linkMark.isInSet(node.marks);
|
|
62
|
-
var url = (0, _utils.normalizeUrl)(href);
|
|
63
|
-
|
|
64
|
-
if (mark && mark.attrs.href === url) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
var rightBound = to && pos !== to ? to : pos - $pos.textOffset + node.nodeSize;
|
|
69
|
-
var tr = state.tr.removeMark(pos, rightBound, linkMark);
|
|
70
|
-
|
|
71
|
-
if (href.trim()) {
|
|
72
|
-
tr.addMark(pos, rightBound, linkMark.create(_objectSpread(_objectSpread({}, mark && mark.attrs || {}), {}, {
|
|
73
|
-
href: url
|
|
74
|
-
})));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (!isTabPressed) {
|
|
78
|
-
tr.setMeta(_main.stateKey, {
|
|
79
|
-
type: _main.LinkAction.HIDE_TOOLBAR
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (dispatch) {
|
|
84
|
-
dispatch(tr);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return true;
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function updateLink(href, text, pos, to) {
|
|
92
|
-
return function (state, dispatch) {
|
|
93
|
-
var $pos = state.doc.resolve(pos);
|
|
94
|
-
var node = state.doc.nodeAt(pos);
|
|
95
|
-
|
|
96
|
-
if (!node) {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
var url = (0, _utils.normalizeUrl)(href);
|
|
101
|
-
|
|
102
|
-
if (!url) {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
var mark = state.schema.marks.link.isInSet(node.marks);
|
|
107
|
-
var linkMark = state.schema.marks.link;
|
|
108
|
-
var rightBound = to && pos !== to ? to : pos - $pos.textOffset + node.nodeSize;
|
|
109
|
-
var tr = state.tr;
|
|
110
|
-
tr.insertText(text, pos, rightBound); // Casting to LinkAttributes to prevent wrong attributes been passed (Example ED-7951)
|
|
111
|
-
|
|
112
|
-
var linkAttrs = _objectSpread(_objectSpread({}, mark && mark.attrs || {}), {}, {
|
|
113
|
-
href: url
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
tr.addMark(pos, pos + text.length, linkMark.create(linkAttrs));
|
|
117
|
-
tr.setMeta(_main.stateKey, {
|
|
118
|
-
type: _main.LinkAction.HIDE_TOOLBAR
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
if (dispatch) {
|
|
122
|
-
dispatch(tr);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return true;
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function setLinkText(text, pos, to) {
|
|
130
|
-
return (0, _commands.filter)(isLinkAtPos(pos), function (state, dispatch) {
|
|
131
|
-
var $pos = state.doc.resolve(pos);
|
|
132
|
-
var node = state.doc.nodeAt(pos);
|
|
133
|
-
var mark = state.schema.marks.link.isInSet(node.marks);
|
|
134
|
-
|
|
135
|
-
if (node && text.length > 0 && text !== node.text) {
|
|
136
|
-
var rightBound = to && pos !== to ? to : pos - $pos.textOffset + node.nodeSize;
|
|
137
|
-
var tr = state.tr;
|
|
138
|
-
tr.insertText(text, pos, rightBound);
|
|
139
|
-
tr.addMark(pos, pos + text.length, mark);
|
|
140
|
-
tr.setMeta(_main.stateKey, {
|
|
141
|
-
type: _main.LinkAction.HIDE_TOOLBAR
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
if (dispatch) {
|
|
145
|
-
dispatch(tr);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return false;
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function insertLink(from, to, href, text // source?: INPUT_METHOD.MANUAL | INPUT_METHOD.TYPEAHEAD,
|
|
156
|
-
) {
|
|
157
|
-
return (0, _commands.filter)((0, _main.canLinkBeCreatedInRange)(from, to), function (state, dispatch) {
|
|
158
|
-
var link = state.schema.marks.link;
|
|
159
|
-
|
|
160
|
-
if (href.trim()) {
|
|
161
|
-
var tr = state.tr;
|
|
162
|
-
var normalizedUrl = (0, _utils.normalizeUrl)(href);
|
|
163
|
-
|
|
164
|
-
if (from === to) {
|
|
165
|
-
var textContent = text || href;
|
|
166
|
-
tr.insertText(textContent, from, to);
|
|
167
|
-
tr.addMark(from, from + textContent.length, link.create({
|
|
168
|
-
href: normalizedUrl
|
|
169
|
-
}));
|
|
170
|
-
} else {
|
|
171
|
-
var _textContent = text || href;
|
|
172
|
-
|
|
173
|
-
tr.insertText(_textContent, from, to);
|
|
174
|
-
tr.addMark(from, from + _textContent.length, link.create({
|
|
175
|
-
href: normalizedUrl
|
|
176
|
-
}));
|
|
177
|
-
tr.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(from + _textContent.length)));
|
|
178
|
-
} // queueCardsFromChangedTr(state, tr, source!, false);
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
tr.setMeta(_main.stateKey, {
|
|
182
|
-
type: _main.LinkAction.HIDE_TOOLBAR
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
if (dispatch) {
|
|
186
|
-
dispatch(tr);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return false;
|
|
193
|
-
});
|
|
194
|
-
} // export const insertLinkWithAnalytics = (
|
|
195
|
-
// inputMethod: LinkInputType,
|
|
196
|
-
// from: number,
|
|
197
|
-
// to: number,
|
|
198
|
-
// href: string,
|
|
199
|
-
// text?: string,
|
|
200
|
-
// ) =>
|
|
201
|
-
// withAnalytics(getLinkCreationAnalyticsEvent(inputMethod, href))(
|
|
202
|
-
// insertLink(from, to, href, text, inputMethod),
|
|
203
|
-
// );
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
function removeLink(pos) {
|
|
207
|
-
return setLinkHref('', pos);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
function editInsertedLink() {
|
|
211
|
-
return function (state, dispatch) {
|
|
212
|
-
if (dispatch) {
|
|
213
|
-
dispatch(state.tr.setMeta(_main.stateKey, {
|
|
214
|
-
type: _main.LinkAction.EDIT_INSERTED_TOOLBAR
|
|
215
|
-
}));
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return true;
|
|
219
|
-
};
|
|
220
|
-
} // export function showLinkToolbar(
|
|
221
|
-
// inputMethod:
|
|
222
|
-
// | INPUT_METHOD.TOOLBAR
|
|
223
|
-
// | INPUT_METHOD.QUICK_INSERT
|
|
224
|
-
// | INPUT_METHOD.SHORTCUT
|
|
225
|
-
// | INPUT_METHOD.INSERT_MENU = INPUT_METHOD.TOOLBAR,
|
|
226
|
-
// ): Command {
|
|
227
|
-
// return function(state, dispatch) {
|
|
228
|
-
// if (dispatch) {
|
|
229
|
-
// let tr = state.tr.setMeta(stateKey, {
|
|
230
|
-
// type: LinkAction.SHOW_INSERT_TOOLBAR,
|
|
231
|
-
// });
|
|
232
|
-
// tr = addAnalytics(state, tr, {
|
|
233
|
-
// action: ACTION.INVOKED,
|
|
234
|
-
// actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
235
|
-
// actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
|
|
236
|
-
// attributes: { inputMethod },
|
|
237
|
-
// eventType: EVENT_TYPE.UI,
|
|
238
|
-
// });
|
|
239
|
-
// dispatch(tr);
|
|
240
|
-
// }
|
|
241
|
-
// return true;
|
|
242
|
-
// };
|
|
243
|
-
// }
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
function hideLinkToolbar() {
|
|
247
|
-
return function (state, dispatch) {
|
|
248
|
-
if (dispatch) {
|
|
249
|
-
dispatch(state.tr.setMeta(_main.stateKey, {
|
|
250
|
-
type: _main.LinkAction.HIDE_TOOLBAR
|
|
251
|
-
}));
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
return true;
|
|
255
|
-
};
|
|
256
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.LinkSchema = exports.LinkPlugin = exports.LinkController = void 0;
|
|
9
|
-
|
|
10
|
-
var _plugin = _interopRequireDefault(require("../../../models/plugin"));
|
|
11
|
-
|
|
12
|
-
var _schema = require("../../../models/schema");
|
|
13
|
-
|
|
14
|
-
var _controller = _interopRequireDefault(require("../../../models/controller"));
|
|
15
|
-
|
|
16
|
-
var _toolbarBtn = _interopRequireDefault(require("./ui/toolbarBtn"));
|
|
17
|
-
|
|
18
|
-
var _main = _interopRequireWildcard(require("./pm-plugins/main"));
|
|
19
|
-
|
|
20
|
-
var _fakeCursorForToolbar = _interopRequireDefault(require("./pm-plugins/fake-cursor-for-toolbar"));
|
|
21
|
-
|
|
22
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
-
|
|
28
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
29
|
-
|
|
30
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
31
|
-
|
|
32
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
|
-
|
|
34
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
35
|
-
|
|
36
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
37
|
-
|
|
38
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
39
|
-
|
|
40
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
41
|
-
|
|
42
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
43
|
-
|
|
44
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
|
-
|
|
46
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
47
|
-
|
|
48
|
-
var PLUGIN_NAME = 'link';
|
|
49
|
-
|
|
50
|
-
var LinkSchema = /*#__PURE__*/function (_InlineSchema) {
|
|
51
|
-
_inherits(LinkSchema, _InlineSchema);
|
|
52
|
-
|
|
53
|
-
var _super = _createSuper(LinkSchema);
|
|
54
|
-
|
|
55
|
-
function LinkSchema() {
|
|
56
|
-
var _this;
|
|
57
|
-
|
|
58
|
-
_classCallCheck(this, LinkSchema);
|
|
59
|
-
|
|
60
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
61
|
-
args[_key] = arguments[_key];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return _possibleConstructorReturn(_this, (_this = _super.call.apply(_super, [this].concat(args)), _this.name = PLUGIN_NAME, _this.priority = 100, _this.inclusive = false, _this.group = 'link', _this.attrs = {
|
|
65
|
-
href: {
|
|
66
|
-
"default": ''
|
|
67
|
-
}
|
|
68
|
-
}, _this.parseDOM = [{
|
|
69
|
-
tag: 'a[href]',
|
|
70
|
-
priority: 100,
|
|
71
|
-
getAttrs: function getAttrs(dom) {
|
|
72
|
-
if (!dom.textContent && !dom.getAttribute('text')) {
|
|
73
|
-
return false;
|
|
74
|
-
} // solve the problem of copying itself
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
href: dom.getAttribute('href')
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}], _this.toDOM = function (node) {
|
|
82
|
-
return ['a', {
|
|
83
|
-
href: node.attrs.href
|
|
84
|
-
}, 0];
|
|
85
|
-
}, _assertThisInitialized(_this)));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return _createClass(LinkSchema);
|
|
89
|
-
}(_schema.InlineSchema);
|
|
90
|
-
|
|
91
|
-
exports.LinkSchema = LinkSchema;
|
|
92
|
-
|
|
93
|
-
var LinkController = /*#__PURE__*/function (_BaseController) {
|
|
94
|
-
_inherits(LinkController, _BaseController);
|
|
95
|
-
|
|
96
|
-
var _super2 = _createSuper(LinkController);
|
|
97
|
-
|
|
98
|
-
function LinkController() {
|
|
99
|
-
var _this2;
|
|
100
|
-
|
|
101
|
-
_classCallCheck(this, LinkController);
|
|
102
|
-
|
|
103
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
104
|
-
args[_key2] = arguments[_key2];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return _possibleConstructorReturn(_this2, (_this2 = _super2.call.apply(_super2, [this].concat(args)), _this2.toolbar = {
|
|
108
|
-
title: '链接',
|
|
109
|
-
icon: 'tu-icon-text-link',
|
|
110
|
-
handler: function handler(editor) {
|
|
111
|
-
// toggleMark(editor.state.schema.marks[PLUGIN_NAME])(editor.state,editor.view.dispatch)
|
|
112
|
-
editor.view.focus();
|
|
113
|
-
},
|
|
114
|
-
renderMenu: _toolbarBtn["default"],
|
|
115
|
-
active: function active(state) {
|
|
116
|
-
return _main.stateKey.getState(state).activeLinkMark;
|
|
117
|
-
},
|
|
118
|
-
disabled: function disabled(state) {
|
|
119
|
-
return !_main.stateKey.getState(state).canInsertLink;
|
|
120
|
-
}
|
|
121
|
-
}, _this2.pmPlugins = [_main["default"], _fakeCursorForToolbar["default"]], _assertThisInitialized(_this2)));
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return _createClass(LinkController);
|
|
125
|
-
}(_controller["default"]);
|
|
126
|
-
|
|
127
|
-
exports.LinkController = LinkController;
|
|
128
|
-
|
|
129
|
-
var LinkPlugin = /*#__PURE__*/function (_BasePlugin) {
|
|
130
|
-
_inherits(LinkPlugin, _BasePlugin);
|
|
131
|
-
|
|
132
|
-
var _super3 = _createSuper(LinkPlugin);
|
|
133
|
-
|
|
134
|
-
function LinkPlugin() {
|
|
135
|
-
var _this3;
|
|
136
|
-
|
|
137
|
-
_classCallCheck(this, LinkPlugin);
|
|
138
|
-
|
|
139
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
140
|
-
args[_key3] = arguments[_key3];
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return _possibleConstructorReturn(_this3, (_this3 = _super3.call.apply(_super3, [this].concat(args)), _this3.name = PLUGIN_NAME, _this3.schema = LinkSchema, _this3.controller = LinkController, _assertThisInitialized(_this3)));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return _createClass(LinkPlugin);
|
|
147
|
-
}(_plugin["default"]);
|
|
148
|
-
|
|
149
|
-
exports.LinkPlugin = LinkPlugin;
|
package/lib/components/rich-editor/plugins/inline/link/pm-plugins/fake-cursor-for-toolbar.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
-
|
|
10
|
-
var _prosemirrorView = require("prosemirror-view");
|
|
11
|
-
|
|
12
|
-
var _main = require("./main");
|
|
13
|
-
|
|
14
|
-
var createTextCursor = function createTextCursor(pos) {
|
|
15
|
-
var node = document.createElement('div');
|
|
16
|
-
node.className = 'ProseMirror-fake-text-cursor';
|
|
17
|
-
return _prosemirrorView.Decoration.widget(pos, node, {
|
|
18
|
-
key: 'hyperlink-text-cursor'
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
var createTextSelection = function createTextSelection(from, to) {
|
|
23
|
-
return _prosemirrorView.Decoration.inline(from, to, {
|
|
24
|
-
"class": 'ProseMirror-fake-text-selection'
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
var getInsertLinkToolbarState = function getInsertLinkToolbarState(editorState) {
|
|
29
|
-
var state = _main.stateKey.getState(editorState);
|
|
30
|
-
|
|
31
|
-
if (state && state.activeLinkMark) {
|
|
32
|
-
if (state.activeLinkMark.type === _main.InsertStatus.INSERT_LINK_TOOLBAR) {
|
|
33
|
-
return state.activeLinkMark;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return undefined;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
var fakeCursorToolbarPlugin = new _prosemirrorState.Plugin({
|
|
41
|
-
state: {
|
|
42
|
-
init: function init() {
|
|
43
|
-
return _prosemirrorView.DecorationSet.empty;
|
|
44
|
-
},
|
|
45
|
-
apply: function apply(tr, pluginState, oldState, newState) {
|
|
46
|
-
var oldInsertToolbarState = getInsertLinkToolbarState(oldState);
|
|
47
|
-
var insertToolbarState = getInsertLinkToolbarState(newState); // Map DecorationSet if it still refers to the same position in the document
|
|
48
|
-
|
|
49
|
-
if (oldInsertToolbarState && insertToolbarState) {
|
|
50
|
-
var from = insertToolbarState.from,
|
|
51
|
-
to = insertToolbarState.to;
|
|
52
|
-
var oldFrom = tr.mapping.map(oldInsertToolbarState.from);
|
|
53
|
-
var oldTo = tr.mapping.map(oldInsertToolbarState.to);
|
|
54
|
-
|
|
55
|
-
if (oldFrom === from && oldTo === to) {
|
|
56
|
-
return pluginState.map(tr.mapping, tr.doc);
|
|
57
|
-
}
|
|
58
|
-
} // Update DecorationSet if new insert toolbar, or if we have moved to a different position in the doc
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (insertToolbarState) {
|
|
62
|
-
var _from = insertToolbarState.from,
|
|
63
|
-
_to = insertToolbarState.to;
|
|
64
|
-
return _prosemirrorView.DecorationSet.create(tr.doc, [_from === _to ? createTextCursor(_from) : createTextSelection(_from, _to)]);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return _prosemirrorView.DecorationSet.empty;
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
props: {
|
|
71
|
-
decorations: function decorations(state) {
|
|
72
|
-
return fakeCursorToolbarPlugin.getState(state);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
var _default = fakeCursorToolbarPlugin;
|
|
77
|
-
exports["default"] = _default;
|