@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,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.setColor = setColor;
|
|
7
|
-
exports.toggleMark = toggleMark;
|
|
8
|
-
|
|
9
|
-
var _util = require("../../util");
|
|
10
|
-
|
|
11
|
-
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); }
|
|
12
|
-
|
|
13
|
-
function setColor(editor, type, color) {
|
|
14
|
-
var state = editor.state; //@ts-ignore
|
|
15
|
-
|
|
16
|
-
var _state$selection = state.selection,
|
|
17
|
-
empty = _state$selection.empty,
|
|
18
|
-
$cursor = _state$selection.$cursor,
|
|
19
|
-
ranges = _state$selection.ranges,
|
|
20
|
-
from = _state$selection.from,
|
|
21
|
-
to = _state$selection.to;
|
|
22
|
-
if (empty && !$cursor || !markApplies(state.doc, ranges, type)) return false;
|
|
23
|
-
|
|
24
|
-
if ($cursor) {
|
|
25
|
-
if (type.isInSet(state.storedMarks || $cursor.marks() || !color)) editor.view.dispatch(state.tr.removeStoredMark(type));else editor.view.dispatch(state.tr.addStoredMark(type.create({
|
|
26
|
-
color: color
|
|
27
|
-
})));
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var tr = state.tr;
|
|
32
|
-
|
|
33
|
-
if (!color) {
|
|
34
|
-
tr.removeMark(state.selection.from, state.selection.to, type);
|
|
35
|
-
} else {
|
|
36
|
-
var isShared = (0, _util.isSharedMark)(editor, from, to, type, {
|
|
37
|
-
color: color
|
|
38
|
-
});
|
|
39
|
-
tr.removeMark(state.selection.from, state.selection.to, type);
|
|
40
|
-
if (!isShared) tr.addMark(from, to, type.create({
|
|
41
|
-
color: color
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
editor.view.dispatch(tr.scrollIntoView());
|
|
46
|
-
editor.view.focus();
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function markApplies(doc, ranges, type) {
|
|
51
|
-
var _loop = function _loop(i) {
|
|
52
|
-
var _ranges$i = ranges[i],
|
|
53
|
-
$from = _ranges$i.$from,
|
|
54
|
-
$to = _ranges$i.$to;
|
|
55
|
-
var can = $from.depth == 0 ? doc.type.allowsMarkType(type) : false;
|
|
56
|
-
doc.nodesBetween($from.pos, $to.pos, function (node) {
|
|
57
|
-
if (can) return false;
|
|
58
|
-
can = node.inlineContent && node.type.allowsMarkType(type);
|
|
59
|
-
});
|
|
60
|
-
if (can) return {
|
|
61
|
-
v: true
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
for (var i = 0; i < ranges.length; i++) {
|
|
66
|
-
var _ret = _loop(i);
|
|
67
|
-
|
|
68
|
-
if (_typeof(_ret) === "object") return _ret.v;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function toggleMark(markType, attrs) {
|
|
75
|
-
return function (state, dispatch) {
|
|
76
|
-
var _state$selection2 = state.selection,
|
|
77
|
-
empty = _state$selection2.empty,
|
|
78
|
-
$cursor = _state$selection2.$cursor,
|
|
79
|
-
ranges = _state$selection2.ranges;
|
|
80
|
-
if (empty && !$cursor || !markApplies(state.doc, ranges, markType)) return false;
|
|
81
|
-
|
|
82
|
-
if (dispatch) {
|
|
83
|
-
if ($cursor) {
|
|
84
|
-
if (markType.isInSet(state.storedMarks || $cursor.marks())) dispatch(state.tr.removeStoredMark(markType));else dispatch(state.tr.addStoredMark(markType.create(attrs)));
|
|
85
|
-
} else {
|
|
86
|
-
var has = false,
|
|
87
|
-
tr = state.tr;
|
|
88
|
-
|
|
89
|
-
for (var i = 0; !has && i < ranges.length; i++) {
|
|
90
|
-
var _ranges$i2 = ranges[i],
|
|
91
|
-
$from = _ranges$i2.$from,
|
|
92
|
-
$to = _ranges$i2.$to;
|
|
93
|
-
has = state.doc.rangeHasMark($from.pos, $to.pos, markType);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
for (var _i = 0; _i < ranges.length; _i++) {
|
|
97
|
-
var _ranges$_i = ranges[_i],
|
|
98
|
-
_$from = _ranges$_i.$from,
|
|
99
|
-
_$to = _ranges$_i.$to;
|
|
100
|
-
|
|
101
|
-
if (has) {
|
|
102
|
-
tr.removeMark(_$from.pos, _$to.pos, markType);
|
|
103
|
-
} else {
|
|
104
|
-
var _$exec, _$exec2;
|
|
105
|
-
|
|
106
|
-
var from = _$from.pos,
|
|
107
|
-
to = _$to.pos,
|
|
108
|
-
start = _$from.nodeAfter,
|
|
109
|
-
end = _$to.nodeBefore;
|
|
110
|
-
var spaceStart = start && start.isText ? ((_$exec = /^\s*/.exec(start.text)) === null || _$exec === void 0 ? void 0 : _$exec[0].length) || 0 : 0;
|
|
111
|
-
var spaceEnd = end && end.isText ? ((_$exec2 = /\s*$/.exec(end.text)) === null || _$exec2 === void 0 ? void 0 : _$exec2[0].length) || 0 : 0;
|
|
112
|
-
|
|
113
|
-
if (from + spaceStart < to) {
|
|
114
|
-
from += spaceStart;
|
|
115
|
-
to -= spaceEnd;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
tr.addMark(from, to, markType.create(attrs));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
dispatch(tr.scrollIntoView());
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return true;
|
|
127
|
-
};
|
|
128
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.FontColor = exports.BackgroundColor = void 0;
|
|
7
|
-
var FontColor;
|
|
8
|
-
exports.FontColor = FontColor;
|
|
9
|
-
|
|
10
|
-
(function (FontColor) {
|
|
11
|
-
FontColor["default"] = "#3F4755";
|
|
12
|
-
FontColor["black1"] = "#141C28";
|
|
13
|
-
FontColor["black2"] = "#6F7886";
|
|
14
|
-
FontColor["black3"] = "#A4ACB9";
|
|
15
|
-
FontColor["red1"] = "#F02673";
|
|
16
|
-
FontColor["red2"] = "#F05E5E";
|
|
17
|
-
FontColor["yellow1"] = "#F0A326";
|
|
18
|
-
FontColor["yellow2"] = "#F6BD16";
|
|
19
|
-
FontColor["green1"] = "#5AD8A6";
|
|
20
|
-
FontColor["green2"] = "#26D8F0";
|
|
21
|
-
FontColor["blue1"] = "#3D26F0";
|
|
22
|
-
FontColor["blue2"] = "#2879FF";
|
|
23
|
-
FontColor["purple1"] = "#A226F0";
|
|
24
|
-
})(FontColor || (exports.FontColor = FontColor = {}));
|
|
25
|
-
|
|
26
|
-
var BackgroundColor;
|
|
27
|
-
exports.BackgroundColor = BackgroundColor;
|
|
28
|
-
|
|
29
|
-
(function (BackgroundColor) {
|
|
30
|
-
BackgroundColor["default"] = "transparent";
|
|
31
|
-
BackgroundColor["red2"] = "rgba(240, 94, 94, 0.2)";
|
|
32
|
-
BackgroundColor["yellow2"] = "rgba(246, 189, 22, 0.2)";
|
|
33
|
-
BackgroundColor["grenn2"] = "rgba(90, 216, 166, 0.2)";
|
|
34
|
-
BackgroundColor["blue2"] = "rgba(40, 121, 255, 0.2)";
|
|
35
|
-
BackgroundColor["purple2"] = "rgba(162, 38, 240, 0.2)";
|
|
36
|
-
BackgroundColor["gray2"] = "rgba(191, 199, 213, 0.2)";
|
|
37
|
-
BackgroundColor["red1"] = "rgba(240, 94, 94, 0.6)";
|
|
38
|
-
BackgroundColor["yellow1"] = "rgba(246, 189, 22, 0.6)";
|
|
39
|
-
BackgroundColor["green1"] = "rgba(90, 216, 166, 0.6)";
|
|
40
|
-
BackgroundColor["blue1"] = "rgba(40, 121, 255, 0.6)";
|
|
41
|
-
BackgroundColor["purple1"] = "rgba(162, 38, 240, 0.6)";
|
|
42
|
-
BackgroundColor["gray1"] = "rgba(191, 199, 213, 0.6)";
|
|
43
|
-
})(BackgroundColor || (exports.BackgroundColor = BackgroundColor = {}));
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
.tita-rich-editor-color-selector {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
box-sizing: border-box;
|
|
5
|
-
padding: 12px 21px 0;
|
|
6
|
-
width: 234px;
|
|
7
|
-
height: 208px;
|
|
8
|
-
background: #ffffff;
|
|
9
|
-
box-shadow: 0px 4px 12px 0px rgba(127, 145, 180, 0.2);
|
|
10
|
-
border-radius: 12px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.tita-rich-editor-color-selector__icon {
|
|
14
|
-
width: 100%;
|
|
15
|
-
height: 100%;
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
justify-content: center;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.tita-rich-editor-color-selector__title {
|
|
22
|
-
font-size: 12px;
|
|
23
|
-
font-weight: 400;
|
|
24
|
-
color: #6f7886;
|
|
25
|
-
line-height: 18px;
|
|
26
|
-
padding-left: 3px;
|
|
27
|
-
margin-bottom: 4px;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.tita-rich-editor-color-selector__color-box {
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-wrap: wrap;
|
|
33
|
-
justify-content: space-between;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.tita-rich-editor-color-selector__color-box > div {
|
|
37
|
-
border: 1px solid #e9ecf0;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.tita-rich-editor-color-selector__item {
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
justify-content: center;
|
|
44
|
-
box-sizing: border-box;
|
|
45
|
-
width: 26px;
|
|
46
|
-
height: 26px;
|
|
47
|
-
border-radius: 4px;
|
|
48
|
-
margin: 3px;
|
|
49
|
-
color: #3f4755;
|
|
50
|
-
cursor: pointer;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.tita-rich-editor-color-selector__item:hover {
|
|
54
|
-
border: 1px solid rgba(40, 121, 255, 0.3);
|
|
55
|
-
box-shadow: 0 0 0 1px #fff inset;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.tita-rich-editor-color-selector__item--active {
|
|
59
|
-
border: 1px solid #2879ff !important;
|
|
60
|
-
box-shadow: 0 0 0 1px #fff inset;
|
|
61
|
-
}
|
|
@@ -1,209 +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.FontColorSchema = exports.FONT_COLOR_SCHEMA_NAME = exports.ColorPlugin = exports.ColorController = exports.BackgroundColorSchema = exports.BACKGROUND_COLOR_SCHEMA_NAME = 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 _prosemirrorCommands = require("prosemirror-commands");
|
|
17
|
-
|
|
18
|
-
var _selector = _interopRequireDefault(require("./selector"));
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
|
-
|
|
24
|
-
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); } }
|
|
25
|
-
|
|
26
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
27
|
-
|
|
28
|
-
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); }
|
|
29
|
-
|
|
30
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
|
-
|
|
32
|
-
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); }; }
|
|
33
|
-
|
|
34
|
-
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); }
|
|
35
|
-
|
|
36
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
|
-
|
|
38
|
-
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; } }
|
|
39
|
-
|
|
40
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
-
|
|
42
|
-
var PLUGIN_NAME = 'color';
|
|
43
|
-
var FONT_COLOR_SCHEMA_NAME = 'fontColor';
|
|
44
|
-
exports.FONT_COLOR_SCHEMA_NAME = FONT_COLOR_SCHEMA_NAME;
|
|
45
|
-
var BACKGROUND_COLOR_SCHEMA_NAME = 'backgroundColor';
|
|
46
|
-
exports.BACKGROUND_COLOR_SCHEMA_NAME = BACKGROUND_COLOR_SCHEMA_NAME;
|
|
47
|
-
var colorReg = /^\s*(rgba\([^)]+\)|rgb\([^)]+\)|#[\d|a-f]{3,6})|\w*/i;
|
|
48
|
-
|
|
49
|
-
var getColorAttrs = function getColorAttrs(style) {
|
|
50
|
-
var color = style;
|
|
51
|
-
|
|
52
|
-
if (color) {
|
|
53
|
-
return {
|
|
54
|
-
color: color
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return false;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
var FontColorSchema = /*#__PURE__*/function (_InlineSchema) {
|
|
62
|
-
_inherits(FontColorSchema, _InlineSchema);
|
|
63
|
-
|
|
64
|
-
var _super = _createSuper(FontColorSchema);
|
|
65
|
-
|
|
66
|
-
function FontColorSchema() {
|
|
67
|
-
var _this;
|
|
68
|
-
|
|
69
|
-
_classCallCheck(this, FontColorSchema);
|
|
70
|
-
|
|
71
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
72
|
-
args[_key] = arguments[_key];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return _possibleConstructorReturn(_this, (_this = _super.call.apply(_super, [this].concat(args)), _this.name = FONT_COLOR_SCHEMA_NAME, _this.attrs = {
|
|
76
|
-
color: {
|
|
77
|
-
"default": ''
|
|
78
|
-
}
|
|
79
|
-
}, _this.parseDOM = [{
|
|
80
|
-
style: 'color',
|
|
81
|
-
getAttrs: getColorAttrs
|
|
82
|
-
}, {
|
|
83
|
-
tag: '*[color]',
|
|
84
|
-
getAttrs: function getAttrs(dom) {
|
|
85
|
-
return getColorAttrs(dom.getAttribute('color'));
|
|
86
|
-
}
|
|
87
|
-
}], _assertThisInitialized(_this)));
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
_createClass(FontColorSchema, [{
|
|
91
|
-
key: "toDOM",
|
|
92
|
-
value: function toDOM(node) {
|
|
93
|
-
return ["span", {
|
|
94
|
-
style: "color:".concat(node.attrs.color || '')
|
|
95
|
-
}, 0];
|
|
96
|
-
}
|
|
97
|
-
}]);
|
|
98
|
-
|
|
99
|
-
return FontColorSchema;
|
|
100
|
-
}(_schema.InlineSchema);
|
|
101
|
-
|
|
102
|
-
exports.FontColorSchema = FontColorSchema;
|
|
103
|
-
|
|
104
|
-
var getBgAttrs = function getBgAttrs(style) {
|
|
105
|
-
var colorMatch = style.match(colorReg);
|
|
106
|
-
if (!colorMatch) return false;
|
|
107
|
-
var background = colorMatch[0];
|
|
108
|
-
|
|
109
|
-
if (background) {
|
|
110
|
-
return {
|
|
111
|
-
color: background
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return false;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
var BackgroundColorSchema = /*#__PURE__*/function (_InlineSchema2) {
|
|
119
|
-
_inherits(BackgroundColorSchema, _InlineSchema2);
|
|
120
|
-
|
|
121
|
-
var _super2 = _createSuper(BackgroundColorSchema);
|
|
122
|
-
|
|
123
|
-
function BackgroundColorSchema() {
|
|
124
|
-
var _this2;
|
|
125
|
-
|
|
126
|
-
_classCallCheck(this, BackgroundColorSchema);
|
|
127
|
-
|
|
128
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
129
|
-
args[_key2] = arguments[_key2];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return _possibleConstructorReturn(_this2, (_this2 = _super2.call.apply(_super2, [this].concat(args)), _this2.name = BACKGROUND_COLOR_SCHEMA_NAME, _this2.attrs = {
|
|
133
|
-
color: {
|
|
134
|
-
"default": ''
|
|
135
|
-
}
|
|
136
|
-
}, _this2.parseDOM = [{
|
|
137
|
-
style: 'background',
|
|
138
|
-
getAttrs: getBgAttrs
|
|
139
|
-
}, {
|
|
140
|
-
style: 'background-color',
|
|
141
|
-
getAttrs: getBgAttrs
|
|
142
|
-
}], _assertThisInitialized(_this2)));
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
_createClass(BackgroundColorSchema, [{
|
|
146
|
-
key: "toDOM",
|
|
147
|
-
value: function toDOM(node) {
|
|
148
|
-
return ["span", {
|
|
149
|
-
style: "background-color:".concat(node.attrs.color || '')
|
|
150
|
-
}, 0];
|
|
151
|
-
}
|
|
152
|
-
}]);
|
|
153
|
-
|
|
154
|
-
return BackgroundColorSchema;
|
|
155
|
-
}(_schema.InlineSchema);
|
|
156
|
-
|
|
157
|
-
exports.BackgroundColorSchema = BackgroundColorSchema;
|
|
158
|
-
|
|
159
|
-
var ColorController = /*#__PURE__*/function (_BaseController) {
|
|
160
|
-
_inherits(ColorController, _BaseController);
|
|
161
|
-
|
|
162
|
-
var _super3 = _createSuper(ColorController);
|
|
163
|
-
|
|
164
|
-
function ColorController() {
|
|
165
|
-
var _this3;
|
|
166
|
-
|
|
167
|
-
_classCallCheck(this, ColorController);
|
|
168
|
-
|
|
169
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
170
|
-
args[_key3] = arguments[_key3];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return _possibleConstructorReturn(_this3, (_this3 = _super3.call.apply(_super3, [this].concat(args)), _this3.toolbar = {
|
|
174
|
-
title: '文字颜色',
|
|
175
|
-
icon: 'tu-icon-text-color',
|
|
176
|
-
handler: function handler(editor) {
|
|
177
|
-
(0, _prosemirrorCommands.toggleMark)(editor.state.schema.marks[PLUGIN_NAME])(editor.state, editor.view.dispatch);
|
|
178
|
-
editor.view.focus();
|
|
179
|
-
},
|
|
180
|
-
renderMenu: _selector["default"]
|
|
181
|
-
}, _assertThisInitialized(_this3)));
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return _createClass(ColorController);
|
|
185
|
-
}(_controller["default"]);
|
|
186
|
-
|
|
187
|
-
exports.ColorController = ColorController;
|
|
188
|
-
|
|
189
|
-
var ColorPlugin = /*#__PURE__*/function (_BasePlugin) {
|
|
190
|
-
_inherits(ColorPlugin, _BasePlugin);
|
|
191
|
-
|
|
192
|
-
var _super4 = _createSuper(ColorPlugin);
|
|
193
|
-
|
|
194
|
-
function ColorPlugin() {
|
|
195
|
-
var _this4;
|
|
196
|
-
|
|
197
|
-
_classCallCheck(this, ColorPlugin);
|
|
198
|
-
|
|
199
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
200
|
-
args[_key4] = arguments[_key4];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return _possibleConstructorReturn(_this4, (_this4 = _super4.call.apply(_super4, [this].concat(args)), _this4.name = PLUGIN_NAME, _this4.schema = [FontColorSchema, BackgroundColorSchema], _this4.controller = ColorController, _assertThisInitialized(_this4)));
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return _createClass(ColorPlugin);
|
|
207
|
-
}(_plugin["default"]);
|
|
208
|
-
|
|
209
|
-
exports.ColorPlugin = ColorPlugin;
|