@atlaskit/editor-core 187.10.8 → 187.12.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/CHANGELOG.md +17 -0
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +1 -4
- package/dist/cjs/editor-next/editor-internal.js +0 -2
- package/dist/cjs/editor-next/hooks/useProviderFactory.js +2 -2
- package/dist/cjs/editor-next/index.js +0 -2
- package/dist/cjs/editor.js +6 -2
- package/dist/cjs/index.js +2 -94
- package/dist/cjs/plugins/help-dialog/ui/index.js +42 -42
- package/dist/cjs/plugins/paste/handlers.js +4 -6
- package/dist/cjs/plugins/text-formatting/actions.js +188 -0
- package/dist/cjs/plugins/text-formatting/commands/text-formatting.js +1 -180
- package/dist/cjs/plugins/text-formatting/index.js +11 -0
- package/dist/cjs/plugins/text-formatting/pm-plugins/keymap.js +8 -8
- package/dist/cjs/plugins/text-formatting/pm-plugins/main.js +8 -8
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +2 -2
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +16 -16
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +8 -8
- package/dist/cjs/plugins/text-formatting/utils.js +8 -36
- package/dist/cjs/ui/ContentStyles/index.js +8 -9
- package/dist/cjs/{editor-next/utils/deprecationWarnings.js → utils/editorDeprecationWarnings.js} +3 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +1 -4
- package/dist/es2019/editor-next/editor-internal.js +0 -2
- package/dist/es2019/editor-next/hooks/useProviderFactory.js +2 -2
- package/dist/es2019/editor-next/index.js +0 -2
- package/dist/es2019/editor.js +5 -0
- package/dist/es2019/index.js +0 -2
- package/dist/es2019/plugins/help-dialog/ui/index.js +1 -1
- package/dist/es2019/plugins/paste/handlers.js +5 -7
- package/dist/es2019/plugins/text-formatting/actions.js +161 -0
- package/dist/es2019/plugins/text-formatting/commands/text-formatting.js +1 -159
- package/dist/es2019/plugins/text-formatting/index.js +115 -102
- package/dist/es2019/plugins/text-formatting/pm-plugins/keymap.js +8 -8
- package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +1 -1
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +9 -9
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +1 -1
- package/dist/es2019/plugins/text-formatting/utils.js +1 -29
- package/dist/es2019/ui/ContentStyles/index.js +2 -3
- package/dist/es2019/{editor-next/utils/deprecationWarnings.js → utils/editorDeprecationWarnings.js} +2 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +1 -4
- package/dist/esm/editor-next/editor-internal.js +0 -2
- package/dist/esm/editor-next/hooks/useProviderFactory.js +2 -2
- package/dist/esm/editor-next/index.js +0 -2
- package/dist/esm/editor.js +6 -2
- package/dist/esm/index.js +0 -2
- package/dist/esm/plugins/help-dialog/ui/index.js +1 -1
- package/dist/esm/plugins/paste/handlers.js +5 -7
- package/dist/esm/plugins/text-formatting/actions.js +168 -0
- package/dist/esm/plugins/text-formatting/commands/text-formatting.js +1 -166
- package/dist/esm/plugins/text-formatting/index.js +11 -0
- package/dist/esm/plugins/text-formatting/pm-plugins/keymap.js +8 -8
- package/dist/esm/plugins/text-formatting/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +1 -1
- package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +9 -9
- package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +1 -1
- package/dist/esm/plugins/text-formatting/utils.js +6 -33
- package/dist/esm/ui/ContentStyles/index.js +2 -3
- package/dist/esm/{editor-next/utils/deprecationWarnings.js → utils/editorDeprecationWarnings.js} +2 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +0 -1
- package/dist/types/editor-next/hooks/useProviderFactory.d.ts +4 -4
- package/dist/types/editor.d.ts +1 -0
- package/dist/types/index.d.ts +6 -4
- package/dist/types/labs/next/presets/default.d.ts +50 -15
- package/dist/types/labs/next/presets/useUniversalPreset.d.ts +2 -2
- package/dist/types/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +1 -1
- package/dist/types/plugins/paste/handlers.d.ts +1 -2
- package/dist/types/plugins/text-formatting/actions.d.ts +22 -0
- package/dist/types/plugins/text-formatting/commands/text-formatting.d.ts +0 -31
- package/dist/types/plugins/text-formatting/index.d.ts +11 -2
- package/dist/types/plugins/text-formatting/pm-plugins/main.d.ts +1 -2
- package/dist/types/plugins/text-formatting/pm-plugins/plugin-key.d.ts +1 -1
- package/dist/types/plugins/text-formatting/utils.d.ts +1 -5
- package/dist/types/types/editor-props.d.ts +11 -12
- package/dist/types/ui/ContentStyles/index.d.ts +1 -1
- package/dist/types/utils/editorDeprecationWarnings.d.ts +2 -0
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +0 -1
- package/dist/types-ts4.5/editor-next/hooks/useProviderFactory.d.ts +4 -4
- package/dist/types-ts4.5/editor.d.ts +1 -0
- package/dist/types-ts4.5/index.d.ts +6 -4
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +50 -15
- package/dist/types-ts4.5/labs/next/presets/useUniversalPreset.d.ts +2 -2
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +1 -1
- package/dist/types-ts4.5/plugins/paste/handlers.d.ts +1 -2
- package/dist/types-ts4.5/plugins/text-formatting/actions.d.ts +22 -0
- package/dist/types-ts4.5/plugins/text-formatting/commands/text-formatting.d.ts +0 -31
- package/dist/types-ts4.5/plugins/text-formatting/index.d.ts +11 -2
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/main.d.ts +1 -2
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/plugin-key.d.ts +1 -1
- package/dist/types-ts4.5/plugins/text-formatting/utils.d.ts +1 -5
- package/dist/types-ts4.5/types/editor-props.d.ts +11 -12
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/editorDeprecationWarnings.d.ts +2 -0
- package/package.json +3 -3
- package/report.api.md +39 -166
- package/tmp/api-report-tmp.d.ts +36 -135
- package/dist/cjs/plugins/text-formatting/styles.js +0 -15
- package/dist/cjs/plugins/text-formatting/types.js +0 -5
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -95
- package/dist/es2019/plugins/text-formatting/styles.js +0 -5
- package/dist/es2019/plugins/text-formatting/types.js +0 -1
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -88
- package/dist/esm/plugins/text-formatting/styles.js +0 -7
- package/dist/esm/plugins/text-formatting/types.js +0 -1
- package/dist/esm/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -88
- package/dist/types/editor-next/utils/deprecationWarnings.d.ts +0 -2
- package/dist/types/plugins/text-formatting/styles.d.ts +0 -2
- package/dist/types/plugins/text-formatting/types.d.ts +0 -30
- package/dist/types/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +0 -87
- package/dist/types-ts4.5/editor-next/utils/deprecationWarnings.d.ts +0 -2
- package/dist/types-ts4.5/plugins/text-formatting/styles.d.ts +0 -2
- package/dist/types-ts4.5/plugins/text-formatting/types.d.ts +0 -30
- package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +0 -87
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.markActive = exports.isArrayContainsContent = exports.hasCode = exports.compareItemsArrays = exports.checkFormattingIsPresent =
|
|
7
|
-
var
|
|
6
|
+
exports.markActive = exports.isArrayContainsContent = exports.hasCode = exports.compareItemsArrays = exports.checkFormattingIsPresent = void 0;
|
|
7
|
+
var _mark = require("@atlaskit/editor-common/mark");
|
|
8
8
|
var _clearFormatting = require("./commands/clear-formatting");
|
|
9
9
|
var hasCode = function hasCode(state, pos) {
|
|
10
10
|
var code = state.schema.marks.code;
|
|
@@ -37,39 +37,11 @@ var markActive = function markActive(state, mark) {
|
|
|
37
37
|
});
|
|
38
38
|
return found;
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Determine if a mark of a specific type exists anywhere in the selection.
|
|
43
|
-
*/
|
|
44
40
|
exports.markActive = markActive;
|
|
45
|
-
var
|
|
41
|
+
var blockStylingIsPresent = function blockStylingIsPresent(state) {
|
|
46
42
|
var _state$selection2 = state.selection,
|
|
47
|
-
$from = _state$selection2.$from,
|
|
48
43
|
from = _state$selection2.from,
|
|
49
|
-
to = _state$selection2.to
|
|
50
|
-
empty = _state$selection2.empty;
|
|
51
|
-
if (empty) {
|
|
52
|
-
return !!markType.isInSet(state.storedMarks || $from.marks());
|
|
53
|
-
}
|
|
54
|
-
var rangeHasMark = false;
|
|
55
|
-
if (state.selection instanceof _cellSelection.CellSelection) {
|
|
56
|
-
state.selection.forEachCell(function (cell, cellPos) {
|
|
57
|
-
var from = cellPos;
|
|
58
|
-
var to = cellPos + cell.nodeSize;
|
|
59
|
-
if (!rangeHasMark) {
|
|
60
|
-
rangeHasMark = state.doc.rangeHasMark(from, to, markType);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
} else {
|
|
64
|
-
rangeHasMark = state.doc.rangeHasMark(from, to, markType);
|
|
65
|
-
}
|
|
66
|
-
return rangeHasMark;
|
|
67
|
-
};
|
|
68
|
-
exports.anyMarkActive = anyMarkActive;
|
|
69
|
-
var blockStylingIsPresent = function blockStylingIsPresent(state) {
|
|
70
|
-
var _state$selection3 = state.selection,
|
|
71
|
-
from = _state$selection3.from,
|
|
72
|
-
to = _state$selection3.to;
|
|
44
|
+
to = _state$selection2.to;
|
|
73
45
|
var isBlockStyling = false;
|
|
74
46
|
state.doc.nodesBetween(from, to, function (node) {
|
|
75
47
|
if (_clearFormatting.FORMATTING_NODE_TYPES.indexOf(node.type.name) !== -1) {
|
|
@@ -83,14 +55,14 @@ var blockStylingIsPresent = function blockStylingIsPresent(state) {
|
|
|
83
55
|
var marksArePresent = function marksArePresent(state) {
|
|
84
56
|
var activeMarkTypes = _clearFormatting.FORMATTING_MARK_TYPES.filter(function (mark) {
|
|
85
57
|
if (!!state.schema.marks[mark]) {
|
|
86
|
-
var _state$
|
|
87
|
-
$from = _state$
|
|
88
|
-
empty = _state$
|
|
58
|
+
var _state$selection3 = state.selection,
|
|
59
|
+
$from = _state$selection3.$from,
|
|
60
|
+
empty = _state$selection3.empty;
|
|
89
61
|
var marks = state.schema.marks;
|
|
90
62
|
if (empty) {
|
|
91
63
|
return !!marks[mark].isInSet(state.storedMarks || $from.marks());
|
|
92
64
|
}
|
|
93
|
-
return anyMarkActive(state, marks[mark]);
|
|
65
|
+
return (0, _mark.anyMarkActive)(state, marks[mark]);
|
|
94
66
|
}
|
|
95
67
|
return false;
|
|
96
68
|
});
|
|
@@ -26,15 +26,14 @@ var _styles12 = require("../../plugins/panel/styles");
|
|
|
26
26
|
var _styles13 = require("../../plugins/fake-text-cursor/styles");
|
|
27
27
|
var _styles14 = require("../../plugins/mentions/styles");
|
|
28
28
|
var _styles15 = require("../../plugins/emoji/styles");
|
|
29
|
-
var _styles16 = require("../../plugins/text
|
|
30
|
-
var _styles17 = require("../../plugins/
|
|
31
|
-
var _styles18 = require("../../plugins/
|
|
32
|
-
var _styles19 = require("../../plugins/expand/ui/styles");
|
|
29
|
+
var _styles16 = require("../../plugins/placeholder-text/styles");
|
|
30
|
+
var _styles17 = require("../../plugins/extension/ui/styles");
|
|
31
|
+
var _styles18 = require("../../plugins/expand/ui/styles");
|
|
33
32
|
var _style = require("../../plugins/media/pm-plugins/alt-text/style");
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
33
|
+
var _styles19 = require("../../plugins/find-replace/styles");
|
|
34
|
+
var _styles20 = require("../../plugins/tasks-and-decisions/styles");
|
|
35
|
+
var _styles21 = require("../../plugins/status/styles");
|
|
36
|
+
var _styles22 = require("../../plugins/date/styles");
|
|
38
37
|
var _getInlineNodeViewProducer = require("../../nodeviews/getInlineNodeViewProducer.styles");
|
|
39
38
|
var _templateObject, _templateObject2;
|
|
40
39
|
/** @jsx jsx */
|
|
@@ -45,7 +44,7 @@ exports.linkStyles = linkStyles;
|
|
|
45
44
|
var contentStyles = function contentStyles(props) {
|
|
46
45
|
return (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), (0, _editorSharedStyles.editorFontSize)({
|
|
47
46
|
theme: props.theme
|
|
48
|
-
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)",
|
|
47
|
+
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles16.placeholderTextStyles, _styles5.placeholderStyles, (0, _styles7.codeBlockStyles)(props), (0, _styles6.blocktypeStyles)(props), (0, _styles.codeMarkSharedStyles)(props), _styles.textColorStyles, _styles8.listsStyles, (0, _styles9.ruleStyles)(props), _styles10.mediaStyles, (0, _styles11.layoutStyles)(props), _styles3.telepointerStyle, _styles4.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles12.panelStyles)(props), _styles13.fakeCursorStyles, _styles14.mentionsStyles, _styles15.emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles17.extensionStyles, (0, _styles18.expandStyles)(props), _styles19.findReplaceStyles, _styles20.taskDecisionStyles, _styles21.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles.smartCardStyles, _styles.smartCardSharedStyles, _styles22.dateStyles, _styles.embedCardStyles, _styles2.unsupportedStyles, _styles.resizerStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
|
|
49
48
|
};
|
|
50
49
|
var createEditorContentStyle = function createEditorContentStyle(styles) {
|
|
51
50
|
return /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
package/dist/cjs/{editor-next/utils/deprecationWarnings.js → utils/editorDeprecationWarnings.js}
RENAMED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
7
|
-
var _versionWrapper = require("
|
|
8
|
-
function
|
|
6
|
+
exports.default = editorDeprecationWarnings;
|
|
7
|
+
var _versionWrapper = require("../version-wrapper");
|
|
8
|
+
function editorDeprecationWarnings(props) {
|
|
9
9
|
if (process.env.NODE_ENV === 'production') {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.
|
|
9
|
+
var version = "187.12.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -156,9 +156,6 @@ export class ReactEditorView extends React.Component {
|
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
158
|
_defineProperty(this, "handleAnalyticsEvent", payload => {
|
|
159
|
-
if (!this.props.allowAnalyticsGASV3) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
159
|
fireAnalyticsEvent(this.props.createAnalyticsEvent)(payload);
|
|
163
160
|
});
|
|
164
161
|
_defineProperty(this, "editorPlugins", []);
|
|
@@ -505,7 +502,7 @@ export class ReactEditorView extends React.Component {
|
|
|
505
502
|
}
|
|
506
503
|
});
|
|
507
504
|
_defineProperty(this, "dispatchAnalyticsEvent", payload => {
|
|
508
|
-
if (this.
|
|
505
|
+
if (this.eventDispatcher) {
|
|
509
506
|
const dispatch = createDispatch(this.eventDispatcher);
|
|
510
507
|
dispatch(analyticsEventKey, {
|
|
511
508
|
payload
|
|
@@ -93,7 +93,6 @@ export function EditorInternalWithoutHooks({
|
|
|
93
93
|
providerFactory: providerFactory,
|
|
94
94
|
onEditorCreated: onEditorCreated,
|
|
95
95
|
onEditorDestroyed: onEditorDestroyed,
|
|
96
|
-
allowAnalyticsGASV3: props.allowAnalyticsGASV3,
|
|
97
96
|
disabled: props.disabled,
|
|
98
97
|
preset: preset,
|
|
99
98
|
render: ({
|
|
@@ -128,7 +127,6 @@ export function EditorInternalWithoutHooks({
|
|
|
128
127
|
primaryToolbarComponents: config.primaryToolbarComponents,
|
|
129
128
|
primaryToolbarIconBefore: props.primaryToolbarIconBefore,
|
|
130
129
|
secondaryToolbarComponents: config.secondaryToolbarComponents,
|
|
131
|
-
insertMenuItems: props.insertMenuItems,
|
|
132
130
|
customContentComponents: props.contentComponents,
|
|
133
131
|
customPrimaryToolbarComponents: props.primaryToolbarComponents,
|
|
134
132
|
customSecondaryToolbarComponents: props.secondaryToolbarComponents,
|
|
@@ -28,8 +28,6 @@ export default function useProviderFactory(props, editorActions, createAnalytics
|
|
|
28
28
|
extensionProviders,
|
|
29
29
|
quickInsert,
|
|
30
30
|
linking,
|
|
31
|
-
smartLinks,
|
|
32
|
-
UNSAFE_cards,
|
|
33
31
|
autoformattingProvider,
|
|
34
32
|
media,
|
|
35
33
|
emojiProvider,
|
|
@@ -44,6 +42,8 @@ export default function useProviderFactory(props, editorActions, createAnalytics
|
|
|
44
42
|
collabEditProvider,
|
|
45
43
|
presenceProvider
|
|
46
44
|
} = props;
|
|
45
|
+
const UNSAFE_cards = props.UNSAFE_cards;
|
|
46
|
+
const smartLinks = props.smartLinks;
|
|
47
47
|
const providerFactory = useRef(new ProviderFactory());
|
|
48
48
|
const [providerState, setProviderState] = useState(createNewState(editorActions, quickInsert, extensionProviders, createAnalyticsEvent));
|
|
49
49
|
const prevProps = usePreviousState({
|
|
@@ -15,7 +15,6 @@ import { useConstructor } from '@atlaskit/editor-common/hooks';
|
|
|
15
15
|
import { useEditorContext } from '../ui/EditorContext';
|
|
16
16
|
import measurements from '../utils/performance/measure-enum';
|
|
17
17
|
import EditorInternal from './editor-internal';
|
|
18
|
-
import deprecationWarnings from './utils/deprecationWarnings';
|
|
19
18
|
import sendDurationAnalytics from './utils/sendDurationAnalytics';
|
|
20
19
|
import trackEditorActions from './utils/trackEditorActions';
|
|
21
20
|
export function Editor(passedProps) {
|
|
@@ -38,7 +37,6 @@ export function Editor(passedProps) {
|
|
|
38
37
|
const experienceStore = useRef();
|
|
39
38
|
const handleAnalyticsEvent = data => fireAnalyticsEvent(createAnalyticsEvent)(data);
|
|
40
39
|
useConstructor(() => {
|
|
41
|
-
deprecationWarnings(props);
|
|
42
40
|
trackEditorActions(editorActions.current, props.performanceTracking, value => handleAnalyticsEvent(value));
|
|
43
41
|
});
|
|
44
42
|
const getExperienceStore = () => experienceStore.current;
|
package/dist/es2019/editor.js
CHANGED
|
@@ -3,6 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
|
+
import editorDeprecationWarnings from './utils/editorDeprecationWarnings';
|
|
6
7
|
import EditorNext from './editor-next';
|
|
7
8
|
import useUniversalPreset from './labs/next/presets/useUniversalPreset';
|
|
8
9
|
const EditorNextWrapper = ({
|
|
@@ -16,6 +17,10 @@ const EditorNextWrapper = ({
|
|
|
16
17
|
}, props));
|
|
17
18
|
};
|
|
18
19
|
export default class Editor extends React.Component {
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(props);
|
|
22
|
+
editorDeprecationWarnings(props);
|
|
23
|
+
}
|
|
19
24
|
render() {
|
|
20
25
|
return jsx(EditorNextWrapper, {
|
|
21
26
|
props: this.props
|
package/dist/es2019/index.js
CHANGED
|
@@ -17,13 +17,11 @@ export { AnnotationUpdateEmitter } from './plugins/annotation';
|
|
|
17
17
|
// Used in mobile bridge
|
|
18
18
|
export { stateKey as mediaPluginKey } from './plugins/media/pm-plugins/main';
|
|
19
19
|
export { mentionPluginKey } from './plugins/mentions';
|
|
20
|
-
export { pluginKey as textFormattingStateKey } from './plugins/text-formatting/pm-plugins/main';
|
|
21
20
|
export { textColorPluginKey } from './plugins/text-color';
|
|
22
21
|
export { changeColor } from './plugins/text-color/commands/change-color';
|
|
23
22
|
export { insertHorizontalRule } from './plugins/rule/commands';
|
|
24
23
|
export { blockPluginStateKey } from './plugins';
|
|
25
24
|
export { pluginKey as listStateKey } from './plugins/list/pm-plugins/main';
|
|
26
|
-
export { toggleSuperscript, toggleSuperscriptWithAnalytics, toggleSubscript, toggleSubscriptWithAnalytics, toggleStrike, toggleStrikeWithAnalytics, toggleCode, toggleCodeWithAnalytics, toggleUnderline, toggleUnderlineWithAnalytics, toggleEm, toggleEmWithAnalytics, toggleStrong, toggleStrongWithAnalytics } from './plugins/text-formatting/commands/text-formatting';
|
|
27
25
|
export { subscribeToToolbarAndPickerUpdates } from './plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates';
|
|
28
26
|
export { subscribeTypeAheadUpdates } from './plugins/view-update-subscription/subscribe/type-ahead-updates';
|
|
29
27
|
export { insertBlockType, insertBlockTypesWithAnalytics, setBlockType, setBlockTypeWithAnalytics } from './plugins/block-type/commands';
|
|
@@ -10,7 +10,7 @@ import AkModalDialog, { ModalTransition, useModal } from '@atlaskit/modal-dialog
|
|
|
10
10
|
import { header, footer, contentWrapper, line, content, row, codeSm, codeMd, codeLg, title, column, dialogHeader } from './styles';
|
|
11
11
|
import * as keymaps from '../../../keymaps';
|
|
12
12
|
import ToolbarButton from '../../../ui/ToolbarButton';
|
|
13
|
-
import { toolbarMessages } from '
|
|
13
|
+
import { toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
14
14
|
import { messages as listMessages } from '../../list/messages';
|
|
15
15
|
import { messages as insertBlockMessages } from '../../insert-block/ui/ToolbarInsertBlock/messages';
|
|
16
16
|
import { messages as blockTypeMessages } from '../../block-type/messages';
|
|
@@ -8,16 +8,16 @@ import { compose, insideTable, isParagraph, isText, isLinkMark, insideTableCell,
|
|
|
8
8
|
import { mapSlice } from '../../utils/slice';
|
|
9
9
|
import { INPUT_METHOD } from '../analytics';
|
|
10
10
|
import { GapCursorSelection, Side } from '../selection/gap-cursor-selection';
|
|
11
|
-
import { linkifyContent } from '@atlaskit/editor-common/utils';
|
|
12
11
|
import { runMacroAutoConvert } from '../macro';
|
|
13
12
|
import { insertMediaAsMediaSingle } from '../media/utils/media-single';
|
|
14
|
-
import { pluginKey as textFormattingPluginKey } from '../text-formatting/pm-plugins/main';
|
|
15
13
|
import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType } from './util';
|
|
16
|
-
import { isListItemNode, isListNode, canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
|
|
14
|
+
import { linkifyContent, isListItemNode, isListNode, canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
|
|
17
15
|
import { insertSliceForLists } from './edge-cases';
|
|
18
16
|
import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
|
|
19
17
|
import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
|
|
20
18
|
import { doesSelectionWhichStartsOrEndsInListContainEntireList } from '../../utils/lists';
|
|
19
|
+
import { anyMarkActive } from '@atlaskit/editor-common/mark';
|
|
20
|
+
|
|
21
21
|
// remove text attribute from mention for copy/paste (GDPR)
|
|
22
22
|
export function handleMention(slice, schema) {
|
|
23
23
|
return mapSlice(slice, node => {
|
|
@@ -88,8 +88,7 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
|
|
|
88
88
|
}
|
|
89
89
|
const filters = [linkifyContent(schema)];
|
|
90
90
|
const selectionMarks = selection.$head.marks();
|
|
91
|
-
|
|
92
|
-
if (selection instanceof TextSelection && Array.isArray(selectionMarks) && selectionMarks.length > 0 && hasOnlyNodesOfType(paragraph, text, emoji, mention, hardBreak)(slice) && (!codeMark.isInSet(selectionMarks) || textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.codeActive) // for codeMarks let's make sure mark is active
|
|
91
|
+
if (selection instanceof TextSelection && Array.isArray(selectionMarks) && selectionMarks.length > 0 && hasOnlyNodesOfType(paragraph, text, emoji, mention, hardBreak)(slice) && (!codeMark.isInSet(selectionMarks) || anyMarkActive(state, codeMark)) // check if there is a code mark anywhere in the selection
|
|
93
92
|
) {
|
|
94
93
|
filters.push(applyTextMarksToSlice(schema, selection.$head.marks()));
|
|
95
94
|
}
|
|
@@ -386,11 +385,10 @@ export function handlePastePreservingMarks(slice, queueCardsFromChangedTr) {
|
|
|
386
385
|
if (selectionMarks.length === 0) {
|
|
387
386
|
return false;
|
|
388
387
|
}
|
|
389
|
-
const textFormattingState = textFormattingPluginKey.getState(state);
|
|
390
388
|
|
|
391
389
|
// special case for codeMark: will preserve mark only if codeMark is currently active
|
|
392
390
|
// won't preserve mark if cursor is on the edge on the mark (namely inactive)
|
|
393
|
-
if (codeMark.isInSet(selectionMarks) && !(
|
|
391
|
+
if (codeMark.isInSet(selectionMarks) && !anyMarkActive(state, codeMark)) {
|
|
394
392
|
return false;
|
|
395
393
|
}
|
|
396
394
|
const isPlainTextSlice = slice.content.childCount === 1 && slice.content.firstChild.type === paragraph && slice.content.firstChild.content.childCount === 1 && slice.content.firstChild.firstChild.type === text;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
3
|
+
import { toggleMark } from '@atlaskit/editor-common/mark';
|
|
4
|
+
export const toggleEm = () => {
|
|
5
|
+
return (state, dispatch) => {
|
|
6
|
+
const {
|
|
7
|
+
em
|
|
8
|
+
} = state.schema.marks;
|
|
9
|
+
if (em) {
|
|
10
|
+
return toggleMark(em)(state, dispatch);
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export const toggleEmWithAnalytics = editorAnalyticsAPI => ({
|
|
16
|
+
inputMethod
|
|
17
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
18
|
+
action: ACTION.FORMATTED,
|
|
19
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
20
|
+
eventType: EVENT_TYPE.TRACK,
|
|
21
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_ITALIC,
|
|
22
|
+
attributes: {
|
|
23
|
+
inputMethod
|
|
24
|
+
}
|
|
25
|
+
})(toggleEm());
|
|
26
|
+
export const toggleStrike = () => {
|
|
27
|
+
return (state, dispatch) => {
|
|
28
|
+
const {
|
|
29
|
+
strike
|
|
30
|
+
} = state.schema.marks;
|
|
31
|
+
if (strike) {
|
|
32
|
+
return toggleMark(strike)(state, dispatch);
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export const toggleStrikeWithAnalytics = editorAnalyticsAPI => ({
|
|
38
|
+
inputMethod
|
|
39
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
40
|
+
action: ACTION.FORMATTED,
|
|
41
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
42
|
+
eventType: EVENT_TYPE.TRACK,
|
|
43
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRIKE,
|
|
44
|
+
attributes: {
|
|
45
|
+
inputMethod
|
|
46
|
+
}
|
|
47
|
+
})(toggleStrike());
|
|
48
|
+
export const toggleStrong = () => {
|
|
49
|
+
return (state, dispatch) => {
|
|
50
|
+
const {
|
|
51
|
+
strong
|
|
52
|
+
} = state.schema.marks;
|
|
53
|
+
if (strong) {
|
|
54
|
+
return toggleMark(strong)(state, dispatch);
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export const toggleStrongWithAnalytics = editorAnalyticsAPI => ({
|
|
60
|
+
inputMethod
|
|
61
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
62
|
+
action: ACTION.FORMATTED,
|
|
63
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
64
|
+
eventType: EVENT_TYPE.TRACK,
|
|
65
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRONG,
|
|
66
|
+
attributes: {
|
|
67
|
+
inputMethod
|
|
68
|
+
}
|
|
69
|
+
})(toggleStrong());
|
|
70
|
+
export const toggleUnderline = () => {
|
|
71
|
+
return (state, dispatch) => {
|
|
72
|
+
const {
|
|
73
|
+
underline
|
|
74
|
+
} = state.schema.marks;
|
|
75
|
+
if (underline) {
|
|
76
|
+
return toggleMark(underline)(state, dispatch);
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export const toggleUnderlineWithAnalytics = editorAnalyticsAPI => ({
|
|
82
|
+
inputMethod
|
|
83
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
84
|
+
action: ACTION.FORMATTED,
|
|
85
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
86
|
+
eventType: EVENT_TYPE.TRACK,
|
|
87
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_UNDERLINE,
|
|
88
|
+
attributes: {
|
|
89
|
+
inputMethod
|
|
90
|
+
}
|
|
91
|
+
})(toggleUnderline());
|
|
92
|
+
export const toggleSuperscript = () => {
|
|
93
|
+
return (state, dispatch) => {
|
|
94
|
+
const {
|
|
95
|
+
subsup
|
|
96
|
+
} = state.schema.marks;
|
|
97
|
+
if (subsup) {
|
|
98
|
+
return toggleMark(subsup, {
|
|
99
|
+
type: 'sup'
|
|
100
|
+
})(state, dispatch);
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export const toggleSuperscriptWithAnalytics = editorAnalyticsAPI => ({
|
|
106
|
+
inputMethod
|
|
107
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
108
|
+
action: ACTION.FORMATTED,
|
|
109
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
110
|
+
eventType: EVENT_TYPE.TRACK,
|
|
111
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUPER,
|
|
112
|
+
attributes: {
|
|
113
|
+
inputMethod
|
|
114
|
+
}
|
|
115
|
+
})(toggleSuperscript());
|
|
116
|
+
export const toggleSubscript = () => {
|
|
117
|
+
return (state, dispatch) => {
|
|
118
|
+
const {
|
|
119
|
+
subsup
|
|
120
|
+
} = state.schema.marks;
|
|
121
|
+
if (subsup) {
|
|
122
|
+
return toggleMark(subsup, {
|
|
123
|
+
type: 'sub'
|
|
124
|
+
})(state, dispatch);
|
|
125
|
+
}
|
|
126
|
+
return false;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
export const toggleSubscriptWithAnalytics = editorAnalyticsAPI => ({
|
|
130
|
+
inputMethod
|
|
131
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
132
|
+
action: ACTION.FORMATTED,
|
|
133
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
134
|
+
eventType: EVENT_TYPE.TRACK,
|
|
135
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUB,
|
|
136
|
+
attributes: {
|
|
137
|
+
inputMethod
|
|
138
|
+
}
|
|
139
|
+
})(toggleSubscript());
|
|
140
|
+
export const toggleCode = () => {
|
|
141
|
+
return (state, dispatch) => {
|
|
142
|
+
const {
|
|
143
|
+
code
|
|
144
|
+
} = state.schema.marks;
|
|
145
|
+
if (code) {
|
|
146
|
+
return toggleMark(code)(state, dispatch);
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
export const toggleCodeWithAnalytics = editorAnalyticsAPI => ({
|
|
152
|
+
inputMethod
|
|
153
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
154
|
+
action: ACTION.FORMATTED,
|
|
155
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
156
|
+
eventType: EVENT_TYPE.TRACK,
|
|
157
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
|
|
158
|
+
attributes: {
|
|
159
|
+
inputMethod
|
|
160
|
+
}
|
|
161
|
+
})(toggleCode());
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { applyMarkOnRange
|
|
2
|
+
import { applyMarkOnRange } from '@atlaskit/editor-common/mark';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { hasCode, markActive } from '../utils';
|
|
5
5
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
@@ -107,164 +107,6 @@ export const moveLeft = () => {
|
|
|
107
107
|
return false;
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
|
-
export const toggleEm = () => {
|
|
111
|
-
return (state, dispatch) => {
|
|
112
|
-
const {
|
|
113
|
-
em
|
|
114
|
-
} = state.schema.marks;
|
|
115
|
-
if (em) {
|
|
116
|
-
return toggleMark(em)(state, dispatch);
|
|
117
|
-
}
|
|
118
|
-
return false;
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
export const toggleEmWithAnalytics = editorAnalyticsAPI => ({
|
|
122
|
-
inputMethod
|
|
123
|
-
}) => withAnalytics(editorAnalyticsAPI, {
|
|
124
|
-
action: ACTION.FORMATTED,
|
|
125
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
126
|
-
eventType: EVENT_TYPE.TRACK,
|
|
127
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_ITALIC,
|
|
128
|
-
attributes: {
|
|
129
|
-
inputMethod
|
|
130
|
-
}
|
|
131
|
-
})(toggleEm());
|
|
132
|
-
export const toggleStrike = () => {
|
|
133
|
-
return (state, dispatch) => {
|
|
134
|
-
const {
|
|
135
|
-
strike
|
|
136
|
-
} = state.schema.marks;
|
|
137
|
-
if (strike) {
|
|
138
|
-
return toggleMark(strike)(state, dispatch);
|
|
139
|
-
}
|
|
140
|
-
return false;
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
export const toggleStrikeWithAnalytics = editorAnalyticsAPI => ({
|
|
144
|
-
inputMethod
|
|
145
|
-
}) => withAnalytics(editorAnalyticsAPI, {
|
|
146
|
-
action: ACTION.FORMATTED,
|
|
147
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
148
|
-
eventType: EVENT_TYPE.TRACK,
|
|
149
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRIKE,
|
|
150
|
-
attributes: {
|
|
151
|
-
inputMethod
|
|
152
|
-
}
|
|
153
|
-
})(toggleStrike());
|
|
154
|
-
export const toggleStrong = () => {
|
|
155
|
-
return (state, dispatch) => {
|
|
156
|
-
const {
|
|
157
|
-
strong
|
|
158
|
-
} = state.schema.marks;
|
|
159
|
-
if (strong) {
|
|
160
|
-
return toggleMark(strong)(state, dispatch);
|
|
161
|
-
}
|
|
162
|
-
return false;
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
export const toggleStrongWithAnalytics = editorAnalyticsAPI => ({
|
|
166
|
-
inputMethod
|
|
167
|
-
}) => withAnalytics(editorAnalyticsAPI, {
|
|
168
|
-
action: ACTION.FORMATTED,
|
|
169
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
170
|
-
eventType: EVENT_TYPE.TRACK,
|
|
171
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRONG,
|
|
172
|
-
attributes: {
|
|
173
|
-
inputMethod
|
|
174
|
-
}
|
|
175
|
-
})(toggleStrong());
|
|
176
|
-
export const toggleUnderline = () => {
|
|
177
|
-
return (state, dispatch) => {
|
|
178
|
-
const {
|
|
179
|
-
underline
|
|
180
|
-
} = state.schema.marks;
|
|
181
|
-
if (underline) {
|
|
182
|
-
return toggleMark(underline)(state, dispatch);
|
|
183
|
-
}
|
|
184
|
-
return false;
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
export const toggleUnderlineWithAnalytics = editorAnalyticsAPI => ({
|
|
188
|
-
inputMethod
|
|
189
|
-
}) => withAnalytics(editorAnalyticsAPI, {
|
|
190
|
-
action: ACTION.FORMATTED,
|
|
191
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
192
|
-
eventType: EVENT_TYPE.TRACK,
|
|
193
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_UNDERLINE,
|
|
194
|
-
attributes: {
|
|
195
|
-
inputMethod
|
|
196
|
-
}
|
|
197
|
-
})(toggleUnderline());
|
|
198
|
-
export const toggleSuperscript = () => {
|
|
199
|
-
return (state, dispatch) => {
|
|
200
|
-
const {
|
|
201
|
-
subsup
|
|
202
|
-
} = state.schema.marks;
|
|
203
|
-
if (subsup) {
|
|
204
|
-
return toggleMark(subsup, {
|
|
205
|
-
type: 'sup'
|
|
206
|
-
})(state, dispatch);
|
|
207
|
-
}
|
|
208
|
-
return false;
|
|
209
|
-
};
|
|
210
|
-
};
|
|
211
|
-
export const toggleSuperscriptWithAnalytics = editorAnalyticsAPI => ({
|
|
212
|
-
inputMethod
|
|
213
|
-
}) => withAnalytics(editorAnalyticsAPI, {
|
|
214
|
-
action: ACTION.FORMATTED,
|
|
215
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
216
|
-
eventType: EVENT_TYPE.TRACK,
|
|
217
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUPER,
|
|
218
|
-
attributes: {
|
|
219
|
-
inputMethod
|
|
220
|
-
}
|
|
221
|
-
})(toggleSuperscript());
|
|
222
|
-
export const toggleSubscript = () => {
|
|
223
|
-
return (state, dispatch) => {
|
|
224
|
-
const {
|
|
225
|
-
subsup
|
|
226
|
-
} = state.schema.marks;
|
|
227
|
-
if (subsup) {
|
|
228
|
-
return toggleMark(subsup, {
|
|
229
|
-
type: 'sub'
|
|
230
|
-
})(state, dispatch);
|
|
231
|
-
}
|
|
232
|
-
return false;
|
|
233
|
-
};
|
|
234
|
-
};
|
|
235
|
-
export const toggleSubscriptWithAnalytics = editorAnalyticsAPI => ({
|
|
236
|
-
inputMethod
|
|
237
|
-
}) => withAnalytics(editorAnalyticsAPI, {
|
|
238
|
-
action: ACTION.FORMATTED,
|
|
239
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
240
|
-
eventType: EVENT_TYPE.TRACK,
|
|
241
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUB,
|
|
242
|
-
attributes: {
|
|
243
|
-
inputMethod
|
|
244
|
-
}
|
|
245
|
-
})(toggleSubscript());
|
|
246
|
-
export const toggleCode = () => {
|
|
247
|
-
return (state, dispatch) => {
|
|
248
|
-
const {
|
|
249
|
-
code
|
|
250
|
-
} = state.schema.marks;
|
|
251
|
-
if (code) {
|
|
252
|
-
return toggleMark(code)(state, dispatch);
|
|
253
|
-
}
|
|
254
|
-
return false;
|
|
255
|
-
};
|
|
256
|
-
};
|
|
257
|
-
export const toggleCodeWithAnalytics = editorAnalyticsAPI => ({
|
|
258
|
-
inputMethod
|
|
259
|
-
}) => withAnalytics(editorAnalyticsAPI, {
|
|
260
|
-
action: ACTION.FORMATTED,
|
|
261
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
262
|
-
eventType: EVENT_TYPE.TRACK,
|
|
263
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
|
|
264
|
-
attributes: {
|
|
265
|
-
inputMethod
|
|
266
|
-
}
|
|
267
|
-
})(toggleCode());
|
|
268
110
|
const createInlineCodeFromTextInput = (from, to, text) => {
|
|
269
111
|
return (state, dispatch) => {
|
|
270
112
|
if (state.selection.empty) {
|