@atlaskit/editor-core 189.0.0 → 189.0.3
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 +13 -0
- package/dist/cjs/labs/next/presets/universal.js +6 -0
- package/dist/cjs/plugins/index.js +2 -2
- package/dist/cjs/plugins/placeholder-text/index.js +6 -240
- package/dist/cjs/plugins/placeholder-text/plugin.js +266 -0
- package/dist/cjs/{ui → plugins/placeholder-text/ui}/FloatingToolbar/styles.js +1 -1
- package/dist/cjs/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.js +1 -1
- package/dist/cjs/ui/Addon/click-area-helper.js +1 -0
- package/dist/cjs/ui/ContentStyles/index.js +12 -11
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +6 -0
- package/dist/es2019/plugins/index.js +1 -1
- package/dist/es2019/plugins/placeholder-text/index.js +1 -224
- package/dist/es2019/plugins/placeholder-text/plugin.js +246 -0
- package/dist/es2019/{ui → plugins/placeholder-text/ui}/FloatingToolbar/styles.js +1 -1
- package/dist/es2019/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.js +1 -1
- package/dist/es2019/ui/Addon/click-area-helper.js +1 -0
- package/dist/es2019/ui/ContentStyles/index.js +2 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +6 -0
- package/dist/esm/plugins/index.js +1 -1
- package/dist/esm/plugins/placeholder-text/index.js +1 -239
- package/dist/esm/plugins/placeholder-text/plugin.js +258 -0
- package/dist/esm/{ui → plugins/placeholder-text/ui}/FloatingToolbar/styles.js +1 -1
- package/dist/esm/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.js +1 -1
- package/dist/esm/ui/Addon/click-area-helper.js +1 -0
- package/dist/esm/ui/ContentStyles/index.js +3 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/index.d.ts +1 -1
- package/dist/types/plugins/placeholder-text/index.d.ts +2 -16
- package/dist/types/plugins/placeholder-text/placeholder-text-nodeview.d.ts +1 -1
- package/dist/types/plugins/placeholder-text/plugin-key.d.ts +2 -2
- package/dist/types/plugins/placeholder-text/plugin.d.ts +7 -0
- package/dist/types/plugins/placeholder-text/types.d.ts +9 -1
- package/dist/types/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.d.ts +2 -2
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types-ts4.5/plugins/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/placeholder-text/index.d.ts +2 -22
- package/dist/types-ts4.5/plugins/placeholder-text/placeholder-text-nodeview.d.ts +1 -1
- package/dist/types-ts4.5/plugins/placeholder-text/plugin-key.d.ts +2 -2
- package/dist/types-ts4.5/plugins/placeholder-text/plugin.d.ts +7 -0
- package/dist/types-ts4.5/plugins/placeholder-text/types.d.ts +12 -1
- package/dist/types-ts4.5/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/package.json +7 -3
- /package/dist/cjs/{ui → plugins/placeholder-text/ui}/FloatingToolbar/index.js +0 -0
- /package/dist/cjs/{ui → plugins/placeholder-text/ui}/FloatingToolbar/utils.js +0 -0
- /package/dist/es2019/{ui → plugins/placeholder-text/ui}/FloatingToolbar/index.js +0 -0
- /package/dist/es2019/{ui → plugins/placeholder-text/ui}/FloatingToolbar/utils.js +0 -0
- /package/dist/esm/{ui → plugins/placeholder-text/ui}/FloatingToolbar/index.js +0 -0
- /package/dist/esm/{ui → plugins/placeholder-text/ui}/FloatingToolbar/utils.js +0 -0
- /package/dist/types/{ui → plugins/placeholder-text/ui}/FloatingToolbar/index.d.ts +0 -0
- /package/dist/types/{ui → plugins/placeholder-text/ui}/FloatingToolbar/styles.d.ts +0 -0
- /package/dist/types/{ui → plugins/placeholder-text/ui}/FloatingToolbar/utils.d.ts +0 -0
- /package/dist/types-ts4.5/{ui → plugins/placeholder-text/ui}/FloatingToolbar/index.d.ts +0 -0
- /package/dist/types-ts4.5/{ui → plugins/placeholder-text/ui}/FloatingToolbar/styles.d.ts +0 -0
- /package/dist/types-ts4.5/{ui → plugins/placeholder-text/ui}/FloatingToolbar/utils.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 189.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#41773](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41773) [`2ad7c026f79`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2ad7c026f79) - ED-20478: partially decouples placeholdertext editor plugin for future package extraction, migrates associated failing integration tests to libra
|
|
8
|
+
|
|
9
|
+
## 189.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#39920](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39920) [`c08ab6beb65`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c08ab6beb65) - [ux] Adding new plugin for paste options toolbar. Also making required changes for the new toolbar in folating-toolbar plugin and paste plugin.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 189.0.0
|
|
4
17
|
|
|
5
18
|
### Major Changes
|
|
@@ -17,6 +17,7 @@ var _editorPluginHelpDialog = require("@atlaskit/editor-plugin-help-dialog");
|
|
|
17
17
|
var _editorPluginMedia = require("@atlaskit/editor-plugin-media");
|
|
18
18
|
var _editorPluginRule = require("@atlaskit/editor-plugin-rule");
|
|
19
19
|
var _editorPluginEmoji = require("@atlaskit/editor-plugin-emoji");
|
|
20
|
+
var _editorPluginPasteOptionsToolbar = require("@atlaskit/editor-plugin-paste-options-toolbar");
|
|
20
21
|
var _editorPluginList = require("@atlaskit/editor-plugin-list");
|
|
21
22
|
var _editorPluginImageUpload = require("@atlaskit/editor-plugin-image-upload");
|
|
22
23
|
var _editorPluginGuideline = require("@atlaskit/editor-plugin-guideline");
|
|
@@ -400,6 +401,11 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
|
|
|
400
401
|
return builder.add(plugin);
|
|
401
402
|
}
|
|
402
403
|
return builder;
|
|
404
|
+
}).maybeAdd(_editorPluginPasteOptionsToolbar.pasteOptionsToolbarPlugin, function (plugin, builder) {
|
|
405
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.paste-options-toolbar')) {
|
|
406
|
+
return builder.add(plugin);
|
|
407
|
+
}
|
|
408
|
+
return builder;
|
|
403
409
|
}).add([_plugins.codeBidiWarningPlugin, {
|
|
404
410
|
appearance: appearance
|
|
405
411
|
}])
|
|
@@ -182,7 +182,7 @@ Object.defineProperty(exports, "pastePlugin", {
|
|
|
182
182
|
Object.defineProperty(exports, "placeholderTextPlugin", {
|
|
183
183
|
enumerable: true,
|
|
184
184
|
get: function get() {
|
|
185
|
-
return _placeholderText.
|
|
185
|
+
return _placeholderText.placeholderTextPlugin;
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
188
|
Object.defineProperty(exports, "tasksAndDecisionsPlugin", {
|
|
@@ -228,7 +228,7 @@ var _macro = _interopRequireDefault(require("./macro"));
|
|
|
228
228
|
var _maxContentSize = _interopRequireDefault(require("./max-content-size"));
|
|
229
229
|
var _panel = _interopRequireDefault(require("./panel"));
|
|
230
230
|
var _paste = _interopRequireDefault(require("./paste"));
|
|
231
|
-
var _placeholderText =
|
|
231
|
+
var _placeholderText = require("./placeholder-text");
|
|
232
232
|
var _tasksAndDecisions = _interopRequireDefault(require("./tasks-and-decisions"));
|
|
233
233
|
var _textColor = _interopRequireDefault(require("./text-color"));
|
|
234
234
|
var _breakout = _interopRequireDefault(require("./breakout"));
|
|
@@ -4,244 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
13
|
-
var _text = _interopRequireDefault(require("@atlaskit/icon/glyph/media-services/text"));
|
|
14
|
-
var _WithPluginState = _interopRequireDefault(require("../../ui/WithPluginState"));
|
|
15
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
|
-
var _cursor = require("../fake-text-cursor/cursor");
|
|
17
|
-
var _PlaceholderFloatingToolbar = _interopRequireDefault(require("./ui/PlaceholderFloatingToolbar"));
|
|
18
|
-
var _actions = require("./actions");
|
|
19
|
-
var _placeholderTextNodeview = require("./placeholder-text-nodeview");
|
|
20
|
-
var _pluginKey = require("./plugin-key");
|
|
21
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
22
|
-
var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
|
|
23
|
-
var _selectionUtils = require("./selection-utils");
|
|
24
|
-
var getOpenTypeAhead = function getOpenTypeAhead(trigger, api) {
|
|
25
|
-
var _api$typeAhead, _api$typeAhead2;
|
|
26
|
-
var typeAheadHandler = api === null || api === void 0 || (_api$typeAhead = api.typeAhead) === null || _api$typeAhead === void 0 || (_api$typeAhead = _api$typeAhead.actions) === null || _api$typeAhead === void 0 ? void 0 : _api$typeAhead.findHandlerByTrigger(trigger);
|
|
27
|
-
if (!typeAheadHandler || !typeAheadHandler.id) {
|
|
28
|
-
return null;
|
|
7
|
+
Object.defineProperty(exports, "placeholderTextPlugin", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _plugin.default;
|
|
29
11
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
inputMethod: _analytics.INPUT_METHOD.KEYBOARD
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
function createPlugin(dispatch, options, api) {
|
|
36
|
-
var allowInserting = !!options.allowInserting;
|
|
37
|
-
return new _safePlugin.SafePlugin({
|
|
38
|
-
key: _pluginKey.pluginKey,
|
|
39
|
-
state: {
|
|
40
|
-
init: function init() {
|
|
41
|
-
return {
|
|
42
|
-
showInsertPanelAt: null,
|
|
43
|
-
allowInserting: allowInserting
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
apply: function apply(tr, state) {
|
|
47
|
-
var meta = tr.getMeta(_pluginKey.pluginKey);
|
|
48
|
-
if (meta && meta.showInsertPanelAt !== undefined) {
|
|
49
|
-
var newState = {
|
|
50
|
-
showInsertPanelAt: meta.showInsertPanelAt,
|
|
51
|
-
allowInserting: allowInserting
|
|
52
|
-
};
|
|
53
|
-
dispatch(_pluginKey.pluginKey, newState);
|
|
54
|
-
return newState;
|
|
55
|
-
} else if (state.showInsertPanelAt) {
|
|
56
|
-
var _newState = {
|
|
57
|
-
showInsertPanelAt: tr.mapping.map(state.showInsertPanelAt),
|
|
58
|
-
allowInserting: allowInserting
|
|
59
|
-
};
|
|
60
|
-
dispatch(_pluginKey.pluginKey, _newState);
|
|
61
|
-
return _newState;
|
|
62
|
-
}
|
|
63
|
-
return state;
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
67
|
-
if (transactions.some(function (txn) {
|
|
68
|
-
return txn.docChanged;
|
|
69
|
-
})) {
|
|
70
|
-
var didPlaceholderExistBeforeTxn = oldState.selection.$head.nodeAfter === newState.selection.$head.nodeAfter;
|
|
71
|
-
var adjacentNode = newState.selection.$head.nodeAfter;
|
|
72
|
-
var adjacentNodePos = newState.selection.$head.pos;
|
|
73
|
-
var placeholderNodeType = newState.schema.nodes.placeholder;
|
|
74
|
-
if (adjacentNode && adjacentNode.type === placeholderNodeType && didPlaceholderExistBeforeTxn) {
|
|
75
|
-
var _$newHead$nodeBefore;
|
|
76
|
-
var $newHead = newState.selection.$head;
|
|
77
|
-
var $oldHead = oldState.selection.$head;
|
|
78
|
-
// Check that cursor has moved forward in the document **and** that there is content before the cursor
|
|
79
|
-
var cursorMoved = $oldHead.pos < $newHead.pos;
|
|
80
|
-
var nodeBeforeHasContent = !(0, _utils.isNodeEmpty)($newHead.nodeBefore);
|
|
81
|
-
var nodeBeforeIsInline = (_$newHead$nodeBefore = $newHead.nodeBefore) === null || _$newHead$nodeBefore === void 0 ? void 0 : _$newHead$nodeBefore.type.isInline;
|
|
82
|
-
if (cursorMoved && (nodeBeforeHasContent || nodeBeforeIsInline)) {
|
|
83
|
-
var _NodeSelection$create = _state.NodeSelection.create(newState.doc, adjacentNodePos),
|
|
84
|
-
$from = _NodeSelection$create.$from,
|
|
85
|
-
$to = _NodeSelection$create.$to;
|
|
86
|
-
return newState.tr.deleteRange($from.pos, $to.pos);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Handle Fake Text Cursor for Floating Toolbar
|
|
92
|
-
if (!_pluginKey.pluginKey.getState(oldState).showInsertPanelAt && _pluginKey.pluginKey.getState(newState).showInsertPanelAt) {
|
|
93
|
-
return newState.tr.setSelection(new _cursor.FakeTextCursorSelection(newState.selection.$from));
|
|
94
|
-
}
|
|
95
|
-
if (_pluginKey.pluginKey.getState(oldState).showInsertPanelAt && !_pluginKey.pluginKey.getState(newState).showInsertPanelAt) {
|
|
96
|
-
if (newState.selection instanceof _cursor.FakeTextCursorSelection) {
|
|
97
|
-
return newState.tr.setSelection(new _state.TextSelection(newState.selection.$from));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return;
|
|
101
|
-
},
|
|
102
|
-
props: {
|
|
103
|
-
handleDOMEvents: {
|
|
104
|
-
beforeinput: function beforeinput(view, event) {
|
|
105
|
-
var state = view.state;
|
|
106
|
-
if (event instanceof InputEvent && !event.isComposing && event.inputType === 'insertText' && (0, _selectionUtils.isSelectionAtPlaceholder)(view.state.selection)) {
|
|
107
|
-
event.stopPropagation();
|
|
108
|
-
event.preventDefault();
|
|
109
|
-
var startNodePosition = state.selection.from;
|
|
110
|
-
var content = event.data || '';
|
|
111
|
-
var tr = view.state.tr;
|
|
112
|
-
tr.delete(startNodePosition, startNodePosition + 1);
|
|
113
|
-
var openTypeAhead = getOpenTypeAhead(content, api);
|
|
114
|
-
if (openTypeAhead) {
|
|
115
|
-
openTypeAhead(tr);
|
|
116
|
-
} else {
|
|
117
|
-
tr.insertText(content);
|
|
118
|
-
}
|
|
119
|
-
view.dispatch(tr);
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
nodeViews: {
|
|
126
|
-
placeholder: function placeholder(node, view, getPos) {
|
|
127
|
-
return new _placeholderTextNodeview.PlaceholderTextNodeView(node, view, getPos);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
var basePlaceholderTextPlugin = function basePlaceholderTextPlugin(_ref) {
|
|
134
|
-
var api = _ref.api,
|
|
135
|
-
options = _ref.config;
|
|
136
|
-
return {
|
|
137
|
-
name: 'placeholderText',
|
|
138
|
-
nodes: function nodes() {
|
|
139
|
-
return [{
|
|
140
|
-
name: 'placeholder',
|
|
141
|
-
node: _adfSchema.placeholder
|
|
142
|
-
}];
|
|
143
|
-
},
|
|
144
|
-
pmPlugins: function pmPlugins() {
|
|
145
|
-
return [{
|
|
146
|
-
name: 'placeholderText',
|
|
147
|
-
plugin: function plugin(_ref2) {
|
|
148
|
-
var dispatch = _ref2.dispatch;
|
|
149
|
-
return createPlugin(dispatch, options, api);
|
|
150
|
-
}
|
|
151
|
-
}];
|
|
152
|
-
},
|
|
153
|
-
contentComponent: function contentComponent(_ref3) {
|
|
154
|
-
var editorView = _ref3.editorView,
|
|
155
|
-
popupsMountPoint = _ref3.popupsMountPoint,
|
|
156
|
-
popupsBoundariesElement = _ref3.popupsBoundariesElement;
|
|
157
|
-
var insertPlaceholderText = function insertPlaceholderText(value) {
|
|
158
|
-
return (0, _actions.insertPlaceholderTextAtSelection)(value)(editorView.state, editorView.dispatch);
|
|
159
|
-
};
|
|
160
|
-
var hidePlaceholderToolbar = function hidePlaceholderToolbar() {
|
|
161
|
-
return (0, _actions.hidePlaceholderFloatingToolbar)(editorView.state, editorView.dispatch);
|
|
162
|
-
};
|
|
163
|
-
var getNodeFromPos = function getNodeFromPos(pos) {
|
|
164
|
-
return editorView.domAtPos(pos).node;
|
|
165
|
-
};
|
|
166
|
-
var getFixedCoordinatesFromPos = function getFixedCoordinatesFromPos(pos) {
|
|
167
|
-
return editorView.coordsAtPos(pos);
|
|
168
|
-
};
|
|
169
|
-
var setFocusInEditor = function setFocusInEditor() {
|
|
170
|
-
return editorView.focus();
|
|
171
|
-
};
|
|
172
|
-
return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
|
|
173
|
-
plugins: {
|
|
174
|
-
placeholderTextState: _pluginKey.pluginKey
|
|
175
|
-
},
|
|
176
|
-
render: function render(_ref4) {
|
|
177
|
-
var _ref4$placeholderText = _ref4.placeholderTextState,
|
|
178
|
-
placeholderTextState = _ref4$placeholderText === void 0 ? {} : _ref4$placeholderText;
|
|
179
|
-
if (placeholderTextState.showInsertPanelAt) {
|
|
180
|
-
return /*#__PURE__*/_react.default.createElement(_PlaceholderFloatingToolbar.default, {
|
|
181
|
-
editorViewDOM: editorView.dom,
|
|
182
|
-
popupsMountPoint: popupsMountPoint,
|
|
183
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
184
|
-
getFixedCoordinatesFromPos: getFixedCoordinatesFromPos,
|
|
185
|
-
getNodeFromPos: getNodeFromPos,
|
|
186
|
-
hidePlaceholderFloatingToolbar: hidePlaceholderToolbar,
|
|
187
|
-
showInsertPanelAt: placeholderTextState.showInsertPanelAt,
|
|
188
|
-
insertPlaceholder: insertPlaceholderText,
|
|
189
|
-
setFocusInEditor: setFocusInEditor
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
};
|
|
198
|
-
var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options, api) {
|
|
199
|
-
if (!options.allowInserting) {
|
|
200
|
-
return plugin;
|
|
201
|
-
}
|
|
202
|
-
plugin.pluginsOptions = {
|
|
203
|
-
quickInsert: function quickInsert(_ref5) {
|
|
204
|
-
var formatMessage = _ref5.formatMessage;
|
|
205
|
-
return [{
|
|
206
|
-
id: 'placeholderText',
|
|
207
|
-
title: formatMessage(_messages.messages.placeholderText),
|
|
208
|
-
description: formatMessage(_messages.messages.placeholderTextDescription),
|
|
209
|
-
priority: 1400,
|
|
210
|
-
keywords: ['placeholder'],
|
|
211
|
-
icon: function icon() {
|
|
212
|
-
return /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
213
|
-
label: ""
|
|
214
|
-
});
|
|
215
|
-
},
|
|
216
|
-
action: function action(insert, state) {
|
|
217
|
-
var _api$analytics;
|
|
218
|
-
var tr = state.tr;
|
|
219
|
-
tr.setMeta(_pluginKey.pluginKey, {
|
|
220
|
-
showInsertPanelAt: tr.selection.anchor
|
|
221
|
-
});
|
|
222
|
-
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
|
|
223
|
-
action: _analytics.ACTION.INSERTED,
|
|
224
|
-
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
225
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PLACEHOLDER_TEXT,
|
|
226
|
-
attributes: {
|
|
227
|
-
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
228
|
-
},
|
|
229
|
-
eventType: _analytics.EVENT_TYPE.TRACK
|
|
230
|
-
})(tr);
|
|
231
|
-
return tr;
|
|
232
|
-
}
|
|
233
|
-
}];
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
return plugin;
|
|
237
|
-
};
|
|
238
|
-
var placeholderTextPlugin = function placeholderTextPlugin(_ref6) {
|
|
239
|
-
var _ref6$config = _ref6.config,
|
|
240
|
-
options = _ref6$config === void 0 ? {} : _ref6$config,
|
|
241
|
-
api = _ref6.api;
|
|
242
|
-
return decorateWithPluginOptions(basePlaceholderTextPlugin({
|
|
243
|
-
config: options,
|
|
244
|
-
api: api
|
|
245
|
-
}), options, api);
|
|
246
|
-
};
|
|
247
|
-
var _default = exports.default = placeholderTextPlugin;
|
|
12
|
+
});
|
|
13
|
+
var _plugin = _interopRequireDefault(require("./plugin"));
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createPlugin = createPlugin;
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
13
|
+
var _text = _interopRequireDefault(require("@atlaskit/icon/glyph/media-services/text"));
|
|
14
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
15
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
|
+
var _cursor = require("../fake-text-cursor/cursor");
|
|
17
|
+
var _PlaceholderFloatingToolbar = _interopRequireDefault(require("./ui/PlaceholderFloatingToolbar"));
|
|
18
|
+
var _actions = require("./actions");
|
|
19
|
+
var _placeholderTextNodeview = require("./placeholder-text-nodeview");
|
|
20
|
+
var _pluginKey = require("./plugin-key");
|
|
21
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
22
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
23
|
+
var _selectionUtils = require("./selection-utils");
|
|
24
|
+
var getOpenTypeAhead = function getOpenTypeAhead(trigger, api) {
|
|
25
|
+
var _api$typeAhead, _api$typeAhead2;
|
|
26
|
+
var typeAheadHandler = api === null || api === void 0 || (_api$typeAhead = api.typeAhead) === null || _api$typeAhead === void 0 || (_api$typeAhead = _api$typeAhead.actions) === null || _api$typeAhead === void 0 ? void 0 : _api$typeAhead.findHandlerByTrigger(trigger);
|
|
27
|
+
if (!typeAheadHandler || !typeAheadHandler.id) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 || (_api$typeAhead2 = _api$typeAhead2.actions) === null || _api$typeAhead2 === void 0 ? void 0 : _api$typeAhead2.openAtTransaction({
|
|
31
|
+
triggerHandler: typeAheadHandler,
|
|
32
|
+
inputMethod: _analytics.INPUT_METHOD.KEYBOARD
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
function createPlugin(dispatch, options, api) {
|
|
36
|
+
var allowInserting = !!options.allowInserting;
|
|
37
|
+
return new _safePlugin.SafePlugin({
|
|
38
|
+
key: _pluginKey.pluginKey,
|
|
39
|
+
state: {
|
|
40
|
+
init: function init() {
|
|
41
|
+
return {
|
|
42
|
+
showInsertPanelAt: null,
|
|
43
|
+
allowInserting: allowInserting
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
apply: function apply(tr, state) {
|
|
47
|
+
var meta = tr.getMeta(_pluginKey.pluginKey);
|
|
48
|
+
if (meta && meta.showInsertPanelAt !== undefined) {
|
|
49
|
+
var newState = {
|
|
50
|
+
showInsertPanelAt: meta.showInsertPanelAt,
|
|
51
|
+
allowInserting: allowInserting
|
|
52
|
+
};
|
|
53
|
+
dispatch(_pluginKey.pluginKey, newState);
|
|
54
|
+
return newState;
|
|
55
|
+
} else if (state.showInsertPanelAt) {
|
|
56
|
+
var _newState = {
|
|
57
|
+
showInsertPanelAt: tr.mapping.map(state.showInsertPanelAt),
|
|
58
|
+
allowInserting: allowInserting
|
|
59
|
+
};
|
|
60
|
+
dispatch(_pluginKey.pluginKey, _newState);
|
|
61
|
+
return _newState;
|
|
62
|
+
}
|
|
63
|
+
return state;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
67
|
+
if (transactions.some(function (txn) {
|
|
68
|
+
return txn.docChanged;
|
|
69
|
+
})) {
|
|
70
|
+
var didPlaceholderExistBeforeTxn = oldState.selection.$head.nodeAfter === newState.selection.$head.nodeAfter;
|
|
71
|
+
var adjacentNode = newState.selection.$head.nodeAfter;
|
|
72
|
+
var adjacentNodePos = newState.selection.$head.pos;
|
|
73
|
+
var placeholderNodeType = newState.schema.nodes.placeholder;
|
|
74
|
+
if (adjacentNode && adjacentNode.type === placeholderNodeType && didPlaceholderExistBeforeTxn) {
|
|
75
|
+
var _$newHead$nodeBefore;
|
|
76
|
+
var $newHead = newState.selection.$head;
|
|
77
|
+
var $oldHead = oldState.selection.$head;
|
|
78
|
+
// Check that cursor has moved forward in the document **and** that there is content before the cursor
|
|
79
|
+
var cursorMoved = $oldHead.pos < $newHead.pos;
|
|
80
|
+
var nodeBeforeHasContent = !(0, _utils.isNodeEmpty)($newHead.nodeBefore);
|
|
81
|
+
var nodeBeforeIsInline = (_$newHead$nodeBefore = $newHead.nodeBefore) === null || _$newHead$nodeBefore === void 0 ? void 0 : _$newHead$nodeBefore.type.isInline;
|
|
82
|
+
if (cursorMoved && (nodeBeforeHasContent || nodeBeforeIsInline)) {
|
|
83
|
+
var _NodeSelection$create = _state.NodeSelection.create(newState.doc, adjacentNodePos),
|
|
84
|
+
$from = _NodeSelection$create.$from,
|
|
85
|
+
$to = _NodeSelection$create.$to;
|
|
86
|
+
return newState.tr.deleteRange($from.pos, $to.pos);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Handle Fake Text Cursor for Floating Toolbar
|
|
92
|
+
if (!_pluginKey.pluginKey.getState(oldState).showInsertPanelAt && _pluginKey.pluginKey.getState(newState).showInsertPanelAt) {
|
|
93
|
+
return newState.tr.setSelection(new _cursor.FakeTextCursorSelection(newState.selection.$from));
|
|
94
|
+
}
|
|
95
|
+
if (_pluginKey.pluginKey.getState(oldState).showInsertPanelAt && !_pluginKey.pluginKey.getState(newState).showInsertPanelAt) {
|
|
96
|
+
if (newState.selection instanceof _cursor.FakeTextCursorSelection) {
|
|
97
|
+
return newState.tr.setSelection(new _state.TextSelection(newState.selection.$from));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
},
|
|
102
|
+
props: {
|
|
103
|
+
handleDOMEvents: {
|
|
104
|
+
beforeinput: function beforeinput(view, event) {
|
|
105
|
+
var state = view.state;
|
|
106
|
+
if (event instanceof InputEvent && !event.isComposing && event.inputType === 'insertText' && (0, _selectionUtils.isSelectionAtPlaceholder)(view.state.selection)) {
|
|
107
|
+
event.stopPropagation();
|
|
108
|
+
event.preventDefault();
|
|
109
|
+
var startNodePosition = state.selection.from;
|
|
110
|
+
var content = event.data || '';
|
|
111
|
+
var tr = view.state.tr;
|
|
112
|
+
tr.delete(startNodePosition, startNodePosition + 1);
|
|
113
|
+
var openTypeAhead = getOpenTypeAhead(content, api);
|
|
114
|
+
if (openTypeAhead) {
|
|
115
|
+
openTypeAhead(tr);
|
|
116
|
+
} else {
|
|
117
|
+
tr.insertText(content);
|
|
118
|
+
}
|
|
119
|
+
view.dispatch(tr);
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
nodeViews: {
|
|
126
|
+
placeholder: function placeholder(node, view, getPos) {
|
|
127
|
+
return new _placeholderTextNodeview.PlaceholderTextNodeView(node, view, getPos);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function ContentComponent(_ref) {
|
|
134
|
+
var editorView = _ref.editorView,
|
|
135
|
+
dependencyApi = _ref.dependencyApi,
|
|
136
|
+
popupsMountPoint = _ref.popupsMountPoint,
|
|
137
|
+
popupsBoundariesElement = _ref.popupsBoundariesElement;
|
|
138
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(dependencyApi, ['placeholderText']),
|
|
139
|
+
placeholderTextState = _useSharedPluginState.placeholderTextState;
|
|
140
|
+
var insertPlaceholderText = function insertPlaceholderText(value) {
|
|
141
|
+
return (0, _actions.insertPlaceholderTextAtSelection)(value)(editorView.state, editorView.dispatch);
|
|
142
|
+
};
|
|
143
|
+
var hidePlaceholderToolbar = function hidePlaceholderToolbar() {
|
|
144
|
+
return (0, _actions.hidePlaceholderFloatingToolbar)(editorView.state, editorView.dispatch);
|
|
145
|
+
};
|
|
146
|
+
var getNodeFromPos = function getNodeFromPos(pos) {
|
|
147
|
+
return editorView.domAtPos(pos).node;
|
|
148
|
+
};
|
|
149
|
+
var getFixedCoordinatesFromPos = function getFixedCoordinatesFromPos(pos) {
|
|
150
|
+
return editorView.coordsAtPos(pos);
|
|
151
|
+
};
|
|
152
|
+
var setFocusInEditor = function setFocusInEditor() {
|
|
153
|
+
return editorView.focus();
|
|
154
|
+
};
|
|
155
|
+
if (placeholderTextState !== null && placeholderTextState !== void 0 && placeholderTextState.showInsertPanelAt) {
|
|
156
|
+
return /*#__PURE__*/_react.default.createElement(_PlaceholderFloatingToolbar.default, {
|
|
157
|
+
editorViewDOM: editorView.dom,
|
|
158
|
+
popupsMountPoint: popupsMountPoint,
|
|
159
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
160
|
+
getFixedCoordinatesFromPos: getFixedCoordinatesFromPos,
|
|
161
|
+
getNodeFromPos: getNodeFromPos,
|
|
162
|
+
hidePlaceholderFloatingToolbar: hidePlaceholderToolbar,
|
|
163
|
+
showInsertPanelAt: placeholderTextState.showInsertPanelAt,
|
|
164
|
+
insertPlaceholder: insertPlaceholderText,
|
|
165
|
+
setFocusInEditor: setFocusInEditor
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
var basePlaceholderTextPlugin = function basePlaceholderTextPlugin(_ref2) {
|
|
171
|
+
var api = _ref2.api,
|
|
172
|
+
options = _ref2.config;
|
|
173
|
+
return {
|
|
174
|
+
name: 'placeholderText',
|
|
175
|
+
nodes: function nodes() {
|
|
176
|
+
return [{
|
|
177
|
+
name: 'placeholder',
|
|
178
|
+
node: _adfSchema.placeholder
|
|
179
|
+
}];
|
|
180
|
+
},
|
|
181
|
+
pmPlugins: function pmPlugins() {
|
|
182
|
+
return [{
|
|
183
|
+
name: 'placeholderText',
|
|
184
|
+
plugin: function plugin(_ref3) {
|
|
185
|
+
var dispatch = _ref3.dispatch;
|
|
186
|
+
return createPlugin(dispatch, options, api);
|
|
187
|
+
}
|
|
188
|
+
}];
|
|
189
|
+
},
|
|
190
|
+
getSharedState: function getSharedState(editorState) {
|
|
191
|
+
if (!editorState) {
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
var _ref4 = _pluginKey.pluginKey.getState(editorState) || {
|
|
195
|
+
showInsertPanelAt: null
|
|
196
|
+
},
|
|
197
|
+
showInsertPanelAt = _ref4.showInsertPanelAt,
|
|
198
|
+
allowInserting = _ref4.allowInserting;
|
|
199
|
+
return {
|
|
200
|
+
showInsertPanelAt: showInsertPanelAt,
|
|
201
|
+
allowInserting: !!allowInserting
|
|
202
|
+
};
|
|
203
|
+
},
|
|
204
|
+
contentComponent: function contentComponent(_ref5) {
|
|
205
|
+
var editorView = _ref5.editorView,
|
|
206
|
+
popupsMountPoint = _ref5.popupsMountPoint,
|
|
207
|
+
popupsBoundariesElement = _ref5.popupsBoundariesElement;
|
|
208
|
+
return /*#__PURE__*/_react.default.createElement(ContentComponent, {
|
|
209
|
+
editorView: editorView,
|
|
210
|
+
popupsMountPoint: popupsMountPoint,
|
|
211
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
212
|
+
dependencyApi: api
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options, api) {
|
|
218
|
+
if (!options.allowInserting) {
|
|
219
|
+
return plugin;
|
|
220
|
+
}
|
|
221
|
+
plugin.pluginsOptions = {
|
|
222
|
+
quickInsert: function quickInsert(_ref6) {
|
|
223
|
+
var formatMessage = _ref6.formatMessage;
|
|
224
|
+
return [{
|
|
225
|
+
id: 'placeholderText',
|
|
226
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.placeholderText),
|
|
227
|
+
description: formatMessage(_messages.toolbarInsertBlockMessages.placeholderTextDescription),
|
|
228
|
+
priority: 1400,
|
|
229
|
+
keywords: ['placeholder'],
|
|
230
|
+
icon: function icon() {
|
|
231
|
+
return /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
232
|
+
label: ""
|
|
233
|
+
});
|
|
234
|
+
},
|
|
235
|
+
action: function action(insert, state) {
|
|
236
|
+
var _api$analytics;
|
|
237
|
+
var tr = state.tr;
|
|
238
|
+
tr.setMeta(_pluginKey.pluginKey, {
|
|
239
|
+
showInsertPanelAt: tr.selection.anchor
|
|
240
|
+
});
|
|
241
|
+
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
|
|
242
|
+
action: _analytics.ACTION.INSERTED,
|
|
243
|
+
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
244
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PLACEHOLDER_TEXT,
|
|
245
|
+
attributes: {
|
|
246
|
+
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
247
|
+
},
|
|
248
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
249
|
+
})(tr);
|
|
250
|
+
return tr;
|
|
251
|
+
}
|
|
252
|
+
}];
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
return plugin;
|
|
256
|
+
};
|
|
257
|
+
var placeholderTextPlugin = function placeholderTextPlugin(_ref7) {
|
|
258
|
+
var _ref7$config = _ref7.config,
|
|
259
|
+
options = _ref7$config === void 0 ? {} : _ref7$config,
|
|
260
|
+
api = _ref7.api;
|
|
261
|
+
return decorateWithPluginOptions(basePlaceholderTextPlugin({
|
|
262
|
+
config: options,
|
|
263
|
+
api: api
|
|
264
|
+
}), options, api);
|
|
265
|
+
};
|
|
266
|
+
var _default = exports.default = placeholderTextPlugin;
|
|
@@ -11,5 +11,5 @@ var _constants = require("@atlaskit/theme/constants");
|
|
|
11
11
|
var _colors = require("@atlaskit/theme/colors");
|
|
12
12
|
var _templateObject, _templateObject2;
|
|
13
13
|
var container = exports.container = function container(height) {
|
|
14
|
-
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n border-radius: ", "px;\n box-shadow: ", ";\n display: flex;\n align-items: center;\n box-sizing: border-box;\n padding:
|
|
14
|
+
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n border-radius: ", "px;\n box-shadow: ", ";\n display: flex;\n align-items: center;\n box-sizing: border-box;\n padding: ", " ", ";\n background-color: ", ";\n ", ";\n"])), (0, _constants.borderRadius)(), "var(--ds-shadow-overlay, ".concat("0 12px 24px -6px ".concat(_colors.N50A, ", 0 0 1px ").concat(_colors.N60A), ")"), "var(--ds-space-050, 4px)", "var(--ds-space-100, 8px)", "var(--ds-background-input, ".concat(_colors.N0, ")"), height ? (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n height: ", "px;\n "])), height) : '');
|
|
15
15
|
};
|
|
@@ -16,7 +16,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
var _reactIntlNext = require("react-intl-next");
|
|
18
18
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
19
|
-
var _FloatingToolbar = _interopRequireWildcard(require("
|
|
19
|
+
var _FloatingToolbar = _interopRequireWildcard(require("../FloatingToolbar"));
|
|
20
20
|
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); }
|
|
21
21
|
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; }
|
|
22
22
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -97,6 +97,7 @@ var outsideProsemirrorEditorClickHandler = function outsideProsemirrorEditorClic
|
|
|
97
97
|
var isEditorFocused = !!(view !== null && view !== void 0 && (_view$hasFocus2 = view.hasFocus) !== null && _view$hasFocus2 !== void 0 && _view$hasFocus2.call(view));
|
|
98
98
|
var isBottomAreaClicked = event.clientY > dom.getBoundingClientRect().bottom;
|
|
99
99
|
if (isBottomAreaClicked) {
|
|
100
|
+
tr.setMeta('outsideProsemirrorEditorClicked', true);
|
|
100
101
|
(0, _commands.addParagraphAtEnd)(tr);
|
|
101
102
|
}
|
|
102
103
|
(0, _selection.setSelectionTopLevelBlocks)(tr, event, dom, view.posAtCoords.bind(view), isEditorFocused);
|
|
@@ -15,16 +15,17 @@ var _mention = require("@atlaskit/editor-common/mention");
|
|
|
15
15
|
var _styles2 = require("../../plugins/collab-edit/styles");
|
|
16
16
|
var _commonStyles = require("@atlaskit/editor-plugin-table/ui/common-styles");
|
|
17
17
|
var _styles3 = require("@atlaskit/editor-plugin-block-type/styles");
|
|
18
|
-
var _styles4 = require("
|
|
18
|
+
var _styles4 = require("@atlaskit/editor-plugin-paste-options-toolbar/styles");
|
|
19
|
+
var _styles5 = require("../../plugins/code-block/styles");
|
|
19
20
|
var _media = require("./media");
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
21
|
+
var _styles6 = require("../../plugins/layout/styles");
|
|
22
|
+
var _styles7 = require("../../plugins/panel/styles");
|
|
23
|
+
var _styles8 = require("../../plugins/fake-text-cursor/styles");
|
|
24
|
+
var _styles9 = require("../../plugins/placeholder-text/styles");
|
|
25
|
+
var _styles10 = require("../../plugins/extension/ui/styles");
|
|
26
|
+
var _styles11 = require("../../plugins/expand/ui/styles");
|
|
27
|
+
var _styles12 = require("../../plugins/find-replace/styles");
|
|
28
|
+
var _styles13 = require("../../plugins/tasks-and-decisions/styles");
|
|
28
29
|
var _status = require("./status");
|
|
29
30
|
var _date = require("./date");
|
|
30
31
|
var _getInlineNodeViewProducer = require("../../nodeviews/getInlineNodeViewProducer.styles");
|
|
@@ -45,9 +46,9 @@ var listsStyles = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _
|
|
|
45
46
|
var emojiStyles = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: inline-block;\n\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", " {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), _emoji.EmojiSharedCssClassName.EMOJI_CONTAINER, _emoji.EmojiSharedCssClassName.EMOJI_NODE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, _editorSharedStyles.akEditorSelectedNodeClassName, _emoji.EmojiSharedCssClassName.EMOJI_SPRITE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Blanket, _editorSharedStyles.SelectionStyle.BoxShadow]));
|
|
46
47
|
var placeholderStyles = exports.placeholderStyles = (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror .placeholder-decoration {\n color: ", ";\n width: 100%;\n pointer-events: none;\n user-select: none;\n\n .placeholder-android {\n pointer-events: none;\n outline: none;\n user-select: none;\n position: absolute;\n }\n }\n"])), "var(--ds-text-subtlest, ".concat(_colors.N200, ")"));
|
|
47
48
|
var contentStyles = function contentStyles(props) {
|
|
48
|
-
return (0, _react2.css)(_templateObject7 || (_templateObject7 = (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)({
|
|
49
|
+
return (0, _react2.css)(_templateObject7 || (_templateObject7 = (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\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)({
|
|
49
50
|
theme: props.theme
|
|
50
|
-
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)",
|
|
51
|
+
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles9.placeholderTextStyles, placeholderStyles, (0, _styles5.codeBlockStyles)(props), (0, _styles3.blocktypeStyles)(props), (0, _styles.codeMarkSharedStyles)(props), _styles.textColorStyles, listsStyles, ruleStyles(props), _media.mediaStyles, (0, _styles6.layoutStyles)(props), _styles2.telepointerStyle, _selection.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles7.panelStyles)(props), _styles8.fakeCursorStyles, mentionsStyles, emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles10.extensionStyles, (0, _styles11.expandStyles)(props), _styles12.findReplaceStyles, _styles4.textHighlightStyle, _styles13.taskDecisionStyles, _status.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles.smartCardStyles, _styles.smartCardSharedStyles, _date.dateStyles, _styles.embedCardStyles, _styles.unsupportedStyles, _styles.resizerStyles, _styles.MediaSharedClassNames.FLOATING_TOOLBAR_COMPONENT);
|
|
51
52
|
};
|
|
52
53
|
var createEditorContentStyle = exports.createEditorContentStyle = function createEditorContentStyle(styles) {
|
|
53
54
|
return /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|