@atlaskit/editor-core 179.0.4 → 179.1.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 +22 -0
- package/dist/cjs/create-editor/ReactEditorView.js +1 -1
- package/dist/cjs/create-editor/create-plugins-list.js +6 -287
- package/dist/cjs/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
- package/dist/cjs/editor.js +5 -7
- package/dist/cjs/labs/next/presets/universal.js +313 -0
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +24 -5
- package/dist/cjs/plugins/floating-toolbar/index.js +6 -0
- package/dist/cjs/plugins/floating-toolbar/pm-plugins/force-focus/index.js +72 -0
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +12 -9
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +3 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
- package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +40 -1
- package/dist/cjs/plugins/list/commands/outdent-list.js +22 -9
- package/dist/cjs/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +30 -12
- package/dist/cjs/plugins/list/utils/analytics.js +18 -2
- package/dist/cjs/plugins/media/commands/linking.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/alt-text/index.js +1 -12
- package/dist/cjs/plugins/media/toolbar/alt-text.js +14 -3
- package/dist/cjs/plugins/media/toolbar/linking-toolbar-appearance.js +6 -6
- package/dist/cjs/plugins/media/toolbar/linking.js +7 -1
- package/dist/cjs/plugins/paste/handlers.js +7 -5
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +17 -0
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +13 -13
- package/dist/cjs/utils/document.js +3 -2
- package/dist/cjs/utils/input-rules.js +3 -2
- package/dist/cjs/utils/lists.js +31 -0
- package/dist/cjs/utils/prepare-quick-insert-provider.js +22 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +5 -293
- package/dist/es2019/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
- package/dist/es2019/editor.js +5 -7
- package/dist/es2019/labs/next/presets/universal.js +311 -0
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +19 -2
- package/dist/es2019/plugins/floating-toolbar/index.js +4 -0
- package/dist/es2019/plugins/floating-toolbar/pm-plugins/force-focus/index.js +59 -0
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +6 -3
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +3 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
- package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +41 -1
- package/dist/es2019/plugins/list/commands/outdent-list.js +16 -1
- package/dist/es2019/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +29 -11
- package/dist/es2019/plugins/list/utils/analytics.js +12 -0
- package/dist/es2019/plugins/media/commands/linking.js +2 -2
- package/dist/es2019/plugins/media/pm-plugins/alt-text/index.js +1 -12
- package/dist/es2019/plugins/media/toolbar/alt-text.js +14 -3
- package/dist/es2019/plugins/media/toolbar/linking-toolbar-appearance.js +6 -6
- package/dist/es2019/plugins/media/toolbar/linking.js +9 -1
- package/dist/es2019/plugins/paste/handlers.js +8 -6
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +17 -0
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +13 -13
- package/dist/es2019/utils/document.js +3 -2
- package/dist/es2019/utils/input-rules.js +3 -2
- package/dist/es2019/utils/lists.js +26 -0
- package/dist/es2019/utils/prepare-quick-insert-provider.js +17 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +6 -287
- package/dist/esm/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
- package/dist/esm/editor.js +5 -7
- package/dist/esm/labs/next/presets/universal.js +306 -0
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +24 -5
- package/dist/esm/plugins/floating-toolbar/index.js +6 -0
- package/dist/esm/plugins/floating-toolbar/pm-plugins/force-focus/index.js +62 -0
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +12 -9
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +3 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
- package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +40 -1
- package/dist/esm/plugins/list/commands/outdent-list.js +15 -2
- package/dist/esm/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +30 -12
- package/dist/esm/plugins/list/utils/analytics.js +12 -0
- package/dist/esm/plugins/media/commands/linking.js +2 -2
- package/dist/esm/plugins/media/pm-plugins/alt-text/index.js +1 -12
- package/dist/esm/plugins/media/toolbar/alt-text.js +14 -3
- package/dist/esm/plugins/media/toolbar/linking-toolbar-appearance.js +6 -6
- package/dist/esm/plugins/media/toolbar/linking.js +7 -1
- package/dist/esm/plugins/paste/handlers.js +8 -6
- package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +17 -0
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +13 -13
- package/dist/esm/utils/document.js +3 -2
- package/dist/esm/utils/input-rules.js +3 -2
- package/dist/esm/utils/lists.js +24 -0
- package/dist/esm/utils/prepare-quick-insert-provider.js +17 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/create-plugins-list.d.ts +5 -4
- package/dist/types/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.d.ts +2 -2
- package/dist/types/labs/next/presets/universal.d.ts +30 -0
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +4 -0
- package/dist/types/plugins/expand/index.d.ts +4 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +18 -0
- package/dist/types/plugins/list/utils/analytics.d.ts +5 -2
- package/dist/types/plugins/media/commands/linking.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +96 -92
- package/dist/types/utils/input-rules.d.ts +2 -1
- package/dist/types/utils/lists.d.ts +2 -0
- package/dist/types/utils/prepare-quick-insert-provider.d.ts +16 -0
- package/package.json +8 -8
- package/report.api.md +89 -79
|
@@ -184,20 +184,20 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
184
184
|
return false;
|
|
185
185
|
}, [onQueryFocus]);
|
|
186
186
|
const queryStyle = css({
|
|
187
|
-
outline: 'none',
|
|
188
|
-
position: 'absolute',
|
|
189
|
-
fontFamily: 'inherit',
|
|
190
|
-
fontSize: 'inherit',
|
|
191
|
-
fontWeight: 'inherit',
|
|
192
|
-
letterSpacing: 'inherit',
|
|
193
|
-
padding: 0,
|
|
194
|
-
height: '100%',
|
|
195
|
-
width: '100%',
|
|
196
|
-
top: 0,
|
|
197
|
-
left: 0,
|
|
198
|
-
background: 'transparent',
|
|
199
|
-
border: 'none',
|
|
200
187
|
'&&': {
|
|
188
|
+
outline: 'none',
|
|
189
|
+
position: 'absolute',
|
|
190
|
+
fontFamily: 'inherit',
|
|
191
|
+
fontSize: 'inherit',
|
|
192
|
+
fontWeight: 'inherit',
|
|
193
|
+
letterSpacing: 'inherit',
|
|
194
|
+
padding: 0,
|
|
195
|
+
height: '100%',
|
|
196
|
+
width: '100%',
|
|
197
|
+
top: 0,
|
|
198
|
+
left: 0,
|
|
199
|
+
background: 'transparent',
|
|
200
|
+
border: 'none',
|
|
201
201
|
color: `${`var(--ds-link, ${colors.B400})`}`
|
|
202
202
|
}
|
|
203
203
|
});
|
|
@@ -28,7 +28,8 @@ export function hasVisibleContent(node) {
|
|
|
28
28
|
}
|
|
29
29
|
for (let index = 0; index < node.childCount; index++) {
|
|
30
30
|
const child = node.child(index);
|
|
31
|
-
|
|
31
|
+
const invisibleNodeTypes = ['paragraph', 'text', 'hardBreak'];
|
|
32
|
+
if (!invisibleNodeTypes.includes(child.type.name) || hasVisibleContent(child)) {
|
|
32
33
|
return true;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
@@ -269,7 +270,7 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
|
|
|
269
270
|
action: ACTION.DOCUMENT_PROCESSING_ERROR,
|
|
270
271
|
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
271
272
|
eventType: EVENT_TYPE.OPERATIONAL,
|
|
272
|
-
|
|
273
|
+
nonPrivacySafeAttributes: {
|
|
273
274
|
errorStack: e instanceof Error ? e.stack : String(e)
|
|
274
275
|
}
|
|
275
276
|
});
|
|
@@ -3,6 +3,7 @@ import { canJoin, findWrapping } from 'prosemirror-transform';
|
|
|
3
3
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
4
4
|
import { createInputRulePlugin } from '@atlaskit/prosemirror-input-rules';
|
|
5
5
|
import { addAnalytics } from '../plugins/analytics';
|
|
6
|
+
import { JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST } from '@atlaskit/editor-common/analytics';
|
|
6
7
|
import { closeHistory } from 'prosemirror-history';
|
|
7
8
|
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
|
8
9
|
import { getFeatureFlags } from '../plugins/feature-flags-context';
|
|
@@ -121,13 +122,13 @@ export const createWrappingJoinRule = ({
|
|
|
121
122
|
if (node) {
|
|
122
123
|
const nodeEnd = node.pos + node.node.nodeSize;
|
|
123
124
|
const after = tr.doc.resolve(nodeEnd).nodeAfter;
|
|
124
|
-
if (after && after.type === nodeType && canJoin(tr.doc, nodeEnd) && (!joinPredicate || joinPredicate(match, after))) {
|
|
125
|
+
if (after && after.type === nodeType && canJoin(tr.doc, nodeEnd) && (!joinPredicate || joinPredicate(match, after, JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.JOINED_TO_LIST_BELOW))) {
|
|
125
126
|
tr.join(nodeEnd);
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
const before = tr.doc.resolve(fixedStart - 1).nodeBefore;
|
|
130
|
-
if (before && before.type === nodeType && canJoin(tr.doc, fixedStart - 1) && (!joinPredicate || joinPredicate(match, before))) {
|
|
131
|
+
if (before && before.type === nodeType && canJoin(tr.doc, fixedStart - 1) && (!joinPredicate || joinPredicate(match, before, JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.JOINED_TO_LIST_ABOVE))) {
|
|
131
132
|
tr.join(fixedStart - 1);
|
|
132
133
|
}
|
|
133
134
|
return tr;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { findRootParentListNode } from '../plugins/list/utils/find';
|
|
2
|
+
export const doesSelectionWhichStartsOrEndsInListContainEntireList = selection => {
|
|
3
|
+
const {
|
|
4
|
+
$from,
|
|
5
|
+
$to,
|
|
6
|
+
from,
|
|
7
|
+
to
|
|
8
|
+
} = selection;
|
|
9
|
+
const selectionParentListItemNodeResolvedPos = findRootParentListNode($from) || findRootParentListNode($to);
|
|
10
|
+
const selectionParentListNode = selectionParentListItemNodeResolvedPos === null || selectionParentListItemNodeResolvedPos === void 0 ? void 0 : selectionParentListItemNodeResolvedPos.parent;
|
|
11
|
+
if (!selectionParentListItemNodeResolvedPos || !selectionParentListNode) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
const startOfEntireList = $from.pos < $to.pos ? selectionParentListItemNodeResolvedPos.pos + $from.depth - 1 : selectionParentListItemNodeResolvedPos.pos + $to.depth - 1;
|
|
15
|
+
const endOfEntireList = $from.pos < $to.pos ? selectionParentListItemNodeResolvedPos.pos + selectionParentListNode.nodeSize - $to.depth - 1 : selectionParentListItemNodeResolvedPos.pos + selectionParentListNode.nodeSize - $from.depth - 1;
|
|
16
|
+
if (!startOfEntireList || !endOfEntireList) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if (from < to) {
|
|
20
|
+
return startOfEntireList >= $from.pos && endOfEntireList <= $to.pos;
|
|
21
|
+
} else if (from > to) {
|
|
22
|
+
return startOfEntireList >= $to.pos && endOfEntireList <= $from.pos;
|
|
23
|
+
} else {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { extensionProviderToQuickInsertProvider, combineQuickInsertProviders } from './extensions';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Used to combine the quickInsert provider and extension provider (if available)
|
|
6
|
+
* Or return a provider that is available (quickInsertProvider preferred)
|
|
7
|
+
* @param editorActions
|
|
8
|
+
* @param extensionProvider
|
|
9
|
+
* @param quickInsert
|
|
10
|
+
* @param createAnalyticsEvent
|
|
11
|
+
* @returns Quick insert provider if available
|
|
12
|
+
*/
|
|
13
|
+
export default function prepareQuickInsertProvider(editorActions, extensionProvider, quickInsert, createAnalyticsEvent) {
|
|
14
|
+
const quickInsertProvider = quickInsert && typeof quickInsert !== 'boolean' && quickInsert.provider;
|
|
15
|
+
const extensionQuickInsertProvider = extensionProvider && extensionProviderToQuickInsertProvider(extensionProvider, editorActions, createAnalyticsEvent);
|
|
16
|
+
return quickInsertProvider && extensionQuickInsertProvider ? combineQuickInsertProviders([quickInsertProvider, extensionQuickInsertProvider]) : quickInsertProvider || extensionQuickInsertProvider;
|
|
17
|
+
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -26,7 +26,7 @@ import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
|
26
26
|
import { findChangedNodesFromTransaction, validateNodes, validNode } from '../utils/nodes';
|
|
27
27
|
import createPluginList from './create-plugins-list';
|
|
28
28
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent, FULL_WIDTH_MODE, getAnalyticsEventsFromTransaction, PLATFORMS } from '../plugins/analytics';
|
|
29
|
-
import { createFeatureFlagsFromProps } from '
|
|
29
|
+
import { createFeatureFlagsFromProps } from './feature-flags-from-props';
|
|
30
30
|
import { getEnabledFeatureFlagKeys } from '../plugins/feature-flags-context/get-enabled-feature-flag-keys';
|
|
31
31
|
import { createErrorReporter, createPMPlugins, processPluginsList } from './create-editor';
|
|
32
32
|
import { getDocStructure } from '../utils/document-logger';
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
-
import
|
|
6
|
-
import { tablesPlugin } from '@atlaskit/editor-plugin-table';
|
|
7
|
-
import { isFullPage as fullPageCheck } from '../utils/is-full-page';
|
|
4
|
+
import createUniversalPreset from '../labs/next/presets/universal';
|
|
8
5
|
import { GUTTER_SIZE_MOBILE_IN_PX } from '../plugins/base/pm-plugins/scroll-gutter';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { createDefaultPreset } from '../labs/next/presets/default';
|
|
12
|
-
import { shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { isFullPage as fullPageCheck } from '../utils/is-full-page';
|
|
7
|
+
import { createFeatureFlagsFromProps } from './feature-flags-from-props';
|
|
13
8
|
var isCodeBlockAllowed = function isCodeBlockAllowed(options) {
|
|
14
9
|
var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
|
|
15
10
|
return exclude.indexOf('codeBlock') === -1;
|
|
@@ -44,7 +39,7 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
44
39
|
var isMobile = appearance === 'mobile';
|
|
45
40
|
var inputTracking = (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : _props$performanceTra.inputTracking;
|
|
46
41
|
var cardOptions = ((_props$linking = props.linking) === null || _props$linking === void 0 ? void 0 : _props$linking.smartLinks) || props.smartLinks || props.UNSAFE_cards;
|
|
47
|
-
return {
|
|
42
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
48
43
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
49
44
|
typeAhead: {
|
|
50
45
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
@@ -97,7 +92,7 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
97
92
|
appearance: props.appearance,
|
|
98
93
|
allowCompositionInputOverride: isMobile
|
|
99
94
|
})
|
|
100
|
-
};
|
|
95
|
+
});
|
|
101
96
|
}
|
|
102
97
|
|
|
103
98
|
/**
|
|
@@ -107,283 +102,7 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
107
102
|
* their placement in the editor toolbar
|
|
108
103
|
*/
|
|
109
104
|
export default function createPluginsList(props, prevProps, createAnalyticsEvent, insertNodeAPI, editorAnalyticsAPI, editorSelectionAPI, getEditorContainerWidth) {
|
|
110
|
-
var
|
|
111
|
-
var appearance = props.appearance;
|
|
112
|
-
var isMobile = appearance === 'mobile';
|
|
113
|
-
var isComment = appearance === 'comment';
|
|
114
|
-
var isFullPage = fullPageCheck(appearance);
|
|
115
|
-
var preset = createDefaultPreset(getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent));
|
|
116
|
-
var featureFlags = createFeatureFlagsFromProps(props);
|
|
117
|
-
var getEditorFeatureFlags = function getEditorFeatureFlags() {
|
|
118
|
-
return featureFlags;
|
|
119
|
-
};
|
|
120
|
-
if (props.allowAnalyticsGASV3) {
|
|
121
|
-
var performanceTracking = props.performanceTracking;
|
|
122
|
-
preset.add([analyticsPlugin, {
|
|
123
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
124
|
-
performanceTracking: performanceTracking
|
|
125
|
-
}]);
|
|
126
|
-
}
|
|
127
|
-
if (props.allowBreakout && isFullPage) {
|
|
128
|
-
preset.add([breakoutPlugin, {
|
|
129
|
-
allowBreakoutButton: props.appearance === 'full-page'
|
|
130
|
-
}]);
|
|
131
|
-
}
|
|
132
|
-
if (props.allowTextAlignment) {
|
|
133
|
-
preset.add(alignmentPlugin);
|
|
134
|
-
}
|
|
135
|
-
preset.add(dataConsumerMarkPlugin);
|
|
136
|
-
if (props.allowTextColor) {
|
|
137
|
-
preset.add([textColorPlugin, props.allowTextColor]);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Needs to be after allowTextColor as order of buttons in toolbar depends on it
|
|
141
|
-
preset.add([listPlugin, {
|
|
142
|
-
restartNumberedLists: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.restartNumberedLists,
|
|
143
|
-
restartNumberedListsToolbar: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.restartNumberedListsToolbar,
|
|
144
|
-
listNumberContinuity: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.listNumberContinuity
|
|
145
|
-
}]);
|
|
146
|
-
if (props.allowRule) {
|
|
147
|
-
preset.add(rulePlugin);
|
|
148
|
-
}
|
|
149
|
-
if (props.allowExpand) {
|
|
150
|
-
preset.add([expandPlugin, {
|
|
151
|
-
allowInsertion: isExpandInsertionEnabled(props),
|
|
152
|
-
useLongPressSelection: false,
|
|
153
|
-
appearance: props.appearance
|
|
154
|
-
}]);
|
|
155
|
-
}
|
|
156
|
-
if (props.media) {
|
|
157
|
-
preset.add([gridPlugin, {
|
|
158
|
-
shouldCalcBreakoutGridLines: isFullPage
|
|
159
|
-
}]);
|
|
160
|
-
var alignLeftOnInsert = typeof props.media.alignLeftOnInsert !== 'undefined' ? props.media.alignLeftOnInsert : isComment;
|
|
161
|
-
var showMediaLayoutOptions = typeof props.media.allowAdvancedToolBarOptions !== 'undefined' ? props.media.allowAdvancedToolBarOptions : isFullPage || isComment;
|
|
162
|
-
preset.add([mediaPlugin, _objectSpread(_objectSpread({}, props.media), {}, {
|
|
163
|
-
allowLazyLoading: !isMobile,
|
|
164
|
-
allowBreakoutSnapPoints: isFullPage,
|
|
165
|
-
allowAdvancedToolBarOptions: showMediaLayoutOptions,
|
|
166
|
-
allowDropzoneDropLine: isFullPage,
|
|
167
|
-
allowMediaSingleEditable: !isMobile,
|
|
168
|
-
allowRemoteDimensionsFetch: !isMobile,
|
|
169
|
-
editorSelectionAPI: editorSelectionAPI,
|
|
170
|
-
// This is a wild one. I didnt quite understand what the code was doing
|
|
171
|
-
// so a bit of guess for now.
|
|
172
|
-
allowMarkingUploadsAsIncomplete: isMobile,
|
|
173
|
-
fullWidthEnabled: props.appearance === 'full-width',
|
|
174
|
-
uploadErrorHandler: props.uploadErrorHandler,
|
|
175
|
-
waitForMediaUpload: props.waitForMediaUpload,
|
|
176
|
-
isCopyPasteEnabled: !isMobile,
|
|
177
|
-
alignLeftOnInsert: alignLeftOnInsert
|
|
178
|
-
})]);
|
|
179
|
-
|
|
180
|
-
// EDM-799: inside caption plugin we do the feature flag in enabling the plugin
|
|
181
|
-
if (getMediaFeatureFlag('captions', props.media.featureFlags)) {
|
|
182
|
-
preset.add(captionPlugin);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
if (props.mentionProvider) {
|
|
186
|
-
var _props$mention$insert, _props$mention, _props$mention2;
|
|
187
|
-
preset.add([mentionsPlugin, {
|
|
188
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
189
|
-
sanitizePrivateContent: props.sanitizePrivateContent,
|
|
190
|
-
insertDisplayName: (_props$mention$insert = (_props$mention = props.mention) === null || _props$mention === void 0 ? void 0 : _props$mention.insertDisplayName) !== null && _props$mention$insert !== void 0 ? _props$mention$insert : props.mentionInsertDisplayName,
|
|
191
|
-
allowZeroWidthSpaceAfter: !isMobile,
|
|
192
|
-
HighlightComponent: (_props$mention2 = props.mention) === null || _props$mention2 === void 0 ? void 0 : _props$mention2.HighlightComponent
|
|
193
|
-
}]);
|
|
194
|
-
}
|
|
195
|
-
if (props.emojiProvider) {
|
|
196
|
-
preset.add([emojiPlugin, {
|
|
197
|
-
createAnalyticsEvent: createAnalyticsEvent
|
|
198
|
-
}]);
|
|
199
|
-
}
|
|
200
|
-
if (props.allowTables) {
|
|
201
|
-
var tableOptions = !props.allowTables || typeof props.allowTables === 'boolean' ? {} : props.allowTables;
|
|
202
|
-
preset.add([tablesPlugin, {
|
|
203
|
-
tableOptions: tableOptions,
|
|
204
|
-
breakoutEnabled: props.appearance === 'full-page',
|
|
205
|
-
allowContextualMenu: !isMobile,
|
|
206
|
-
fullWidthEnabled: props.appearance === 'full-width',
|
|
207
|
-
wasFullWidthEnabled: prevProps && prevProps.appearance === 'full-width',
|
|
208
|
-
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
209
|
-
editorSelectionAPI: editorSelectionAPI,
|
|
210
|
-
getEditorFeatureFlags: getEditorFeatureFlags
|
|
211
|
-
}]);
|
|
212
|
-
}
|
|
213
|
-
if (props.allowTasksAndDecisions || props.taskDecisionProvider) {
|
|
214
|
-
preset.add([tasksAndDecisionsPlugin, {
|
|
215
|
-
allowNestedTasks: props.allowNestedTasks,
|
|
216
|
-
consumeTabs: isFullPage,
|
|
217
|
-
useLongPressSelection: false
|
|
218
|
-
}]);
|
|
219
|
-
}
|
|
220
|
-
if (props.feedbackInfo) {
|
|
221
|
-
preset.add([feedbackDialogPlugin, props.feedbackInfo]);
|
|
222
|
-
}
|
|
223
|
-
if (props.allowHelpDialog) {
|
|
224
|
-
preset.add([helpDialogPlugin, !!props.legacyImageUploadProvider]);
|
|
225
|
-
}
|
|
226
|
-
if (props.saveOnEnter && props.onSave) {
|
|
227
|
-
preset.add([saveOnEnterPlugin, props.onSave]);
|
|
228
|
-
}
|
|
229
|
-
if (props.legacyImageUploadProvider) {
|
|
230
|
-
preset.add(imageUploadPlugin);
|
|
231
|
-
if (!props.media) {
|
|
232
|
-
preset.add([mediaPlugin, {
|
|
233
|
-
allowMediaSingle: {
|
|
234
|
-
disableLayout: true
|
|
235
|
-
},
|
|
236
|
-
allowMediaGroup: false,
|
|
237
|
-
isCopyPasteEnabled: true,
|
|
238
|
-
editorSelectionAPI: editorSelectionAPI
|
|
239
|
-
}]);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
if (props.collabEdit || props.collabEditProvider) {
|
|
243
|
-
var _collabEditOptions$EX;
|
|
244
|
-
var collabEditOptions = {
|
|
245
|
-
sanitizePrivateContent: props.sanitizePrivateContent,
|
|
246
|
-
createAnalyticsEvent: createAnalyticsEvent
|
|
247
|
-
};
|
|
248
|
-
if (props.collabEdit) {
|
|
249
|
-
collabEditOptions = _objectSpread(_objectSpread({}, props.collabEdit), collabEditOptions);
|
|
250
|
-
}
|
|
251
|
-
preset.add([collabEditPlugin, _objectSpread(_objectSpread({}, collabEditOptions), {}, {
|
|
252
|
-
EXPERIMENTAL_allowInternalErrorAnalytics: (_collabEditOptions$EX = collabEditOptions.EXPERIMENTAL_allowInternalErrorAnalytics) !== null && _collabEditOptions$EX !== void 0 ? _collabEditOptions$EX : shouldForceTracking()
|
|
253
|
-
})]);
|
|
254
|
-
}
|
|
255
|
-
if (props.maxContentSize) {
|
|
256
|
-
preset.add([maxContentSizePlugin, props.maxContentSize]);
|
|
257
|
-
}
|
|
258
|
-
if (props.allowJiraIssue) {
|
|
259
|
-
preset.add(jiraIssuePlugin);
|
|
260
|
-
}
|
|
261
|
-
if (props.allowPanel) {
|
|
262
|
-
preset.add([panelPlugin, {
|
|
263
|
-
useLongPressSelection: false,
|
|
264
|
-
allowCustomPanel: props.allowPanel.allowCustomPanel,
|
|
265
|
-
allowCustomPanelEdit: props.allowPanel.allowCustomPanelEdit
|
|
266
|
-
}]);
|
|
267
|
-
}
|
|
268
|
-
if (props.allowExtension) {
|
|
269
|
-
var extensionConfig = _typeof(props.allowExtension) === 'object' ? props.allowExtension : {};
|
|
270
|
-
preset.add([extensionPlugin, {
|
|
271
|
-
breakoutEnabled: props.appearance === 'full-page' && extensionConfig.allowBreakout !== false,
|
|
272
|
-
allowAutoSave: extensionConfig.allowAutoSave,
|
|
273
|
-
extensionHandlers: props.extensionHandlers,
|
|
274
|
-
useLongPressSelection: false,
|
|
275
|
-
appearance: appearance
|
|
276
|
-
}]);
|
|
277
|
-
}
|
|
278
|
-
if (props.macroProvider) {
|
|
279
|
-
preset.add(macroPlugin);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// See default list for when adding annotations with a provider
|
|
283
|
-
if (!props.annotationProviders && props.allowConfluenceInlineComment) {
|
|
284
|
-
preset.add([annotationPlugin, undefined]);
|
|
285
|
-
}
|
|
286
|
-
if (props.allowDate) {
|
|
287
|
-
preset.add(datePlugin);
|
|
288
|
-
}
|
|
289
|
-
if (props.allowTemplatePlaceholders) {
|
|
290
|
-
var options = props.allowTemplatePlaceholders !== true ? props.allowTemplatePlaceholders : {};
|
|
291
|
-
preset.add([placeholderTextPlugin, options]);
|
|
292
|
-
}
|
|
293
|
-
if (props.allowLayouts) {
|
|
294
|
-
preset.add([layoutPlugin, _objectSpread(_objectSpread({}, typeof props.allowLayouts === 'boolean' ? {} : props.allowLayouts), {}, {
|
|
295
|
-
useLongPressSelection: false,
|
|
296
|
-
UNSAFE_allowSingleColumnLayout: props.allowLayouts.UNSAFE_allowSingleColumnLayout
|
|
297
|
-
})]);
|
|
298
|
-
}
|
|
299
|
-
if ((_props$linking3 = props.linking) !== null && _props$linking3 !== void 0 && _props$linking3.smartLinks || props.smartLinks || props.UNSAFE_cards) {
|
|
300
|
-
var _props$linking4, _props$linking5;
|
|
301
|
-
var fullWidthMode = props.appearance === 'full-width';
|
|
302
|
-
preset.add([cardPlugin, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, props.UNSAFE_cards), props.smartLinks), (_props$linking4 = props.linking) === null || _props$linking4 === void 0 ? void 0 : _props$linking4.smartLinks), {}, {
|
|
303
|
-
platform: isMobile ? 'mobile' : 'web',
|
|
304
|
-
fullWidthMode: fullWidthMode,
|
|
305
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
306
|
-
linkPicker: (_props$linking5 = props.linking) === null || _props$linking5 === void 0 ? void 0 : _props$linking5.linkPicker
|
|
307
|
-
})]);
|
|
308
|
-
}
|
|
309
|
-
if (props.autoformattingProvider) {
|
|
310
|
-
preset.add(customAutoformatPlugin);
|
|
311
|
-
}
|
|
312
|
-
var statusMenuDisabled = true;
|
|
313
|
-
if (props.allowStatus) {
|
|
314
|
-
statusMenuDisabled = _typeof(props.allowStatus) === 'object' ? props.allowStatus.menuDisabled : false;
|
|
315
|
-
preset.add([statusPlugin, {
|
|
316
|
-
menuDisabled: statusMenuDisabled,
|
|
317
|
-
allowZeroWidthSpaceAfter: !isMobile
|
|
318
|
-
}]);
|
|
319
|
-
}
|
|
320
|
-
if (props.allowIndentation) {
|
|
321
|
-
preset.add(indentationPlugin);
|
|
322
|
-
}
|
|
323
|
-
if (isFullPage) {
|
|
324
|
-
preset.add(contextPanelPlugin);
|
|
325
|
-
}
|
|
326
|
-
if (props.autoScrollIntoView !== false) {
|
|
327
|
-
preset.add(scrollIntoViewPlugin);
|
|
328
|
-
}
|
|
329
|
-
if (isMobile || props.allowUndoRedoButtons) {
|
|
330
|
-
preset.add(historyPlugin);
|
|
331
|
-
}
|
|
332
|
-
if (isMobile) {
|
|
333
|
-
preset.add(mobileDimensionsPlugin);
|
|
334
|
-
preset.add(mobileSelectionPlugin);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
// UI only plugins
|
|
338
|
-
preset.add([toolbarListsIndentationPlugin, {
|
|
339
|
-
showIndentationButtons: !!featureFlags.indentationButtonsInTheToolbar,
|
|
340
|
-
allowHeadingAndParagraphIndentation: !!props.allowIndentation
|
|
341
|
-
}]);
|
|
342
|
-
preset.add([insertBlockPlugin, {
|
|
343
|
-
allowTables: !!props.allowTables,
|
|
344
|
-
allowExpand: isExpandInsertionEnabled(props),
|
|
345
|
-
insertMenuItems: props.insertMenuItems,
|
|
346
|
-
horizontalRuleEnabled: props.allowRule,
|
|
347
|
-
nativeStatusSupported: !statusMenuDisabled,
|
|
348
|
-
showElementBrowserLink: props.elementBrowser && props.elementBrowser.showModal || false,
|
|
349
|
-
replacePlusMenuWithElementBrowser: props.elementBrowser && props.elementBrowser.replacePlusMenu || false,
|
|
350
|
-
insertNodeAPI: insertNodeAPI
|
|
351
|
-
}]);
|
|
352
|
-
var hasBeforePrimaryToolbar = function hasBeforePrimaryToolbar(components) {
|
|
353
|
-
if (components && 'before' in components) {
|
|
354
|
-
return !!components.before;
|
|
355
|
-
}
|
|
356
|
-
return false;
|
|
357
|
-
};
|
|
358
|
-
if (hasBeforePrimaryToolbar(props.primaryToolbarComponents) && !featureFlags.twoLineEditorToolbar) {
|
|
359
|
-
preset.add([beforePrimaryToolbarPlugin, {
|
|
360
|
-
beforePrimaryToolbarComponents: props.primaryToolbarComponents.before
|
|
361
|
-
}]);
|
|
362
|
-
}
|
|
363
|
-
if (featureFlags.showAvatarGroupAsPlugin === true && !featureFlags.twoLineEditorToolbar) {
|
|
364
|
-
preset.add([avatarGroupPlugin, {
|
|
365
|
-
collabEdit: props.collabEdit,
|
|
366
|
-
takeFullWidth: !hasBeforePrimaryToolbar(props.primaryToolbarComponents)
|
|
367
|
-
}]);
|
|
368
|
-
}
|
|
369
|
-
if (props.allowFindReplace) {
|
|
370
|
-
preset.add([findReplacePlugin, {
|
|
371
|
-
takeFullWidth: !!featureFlags.showAvatarGroupAsPlugin === false && !hasBeforePrimaryToolbar(props.primaryToolbarComponents),
|
|
372
|
-
twoLineEditorToolbar: !!featureFlags.twoLineEditorToolbar
|
|
373
|
-
}]);
|
|
374
|
-
}
|
|
375
|
-
if (props.allowFragmentMark) {
|
|
376
|
-
preset.add(fragmentMarkPlugin);
|
|
377
|
-
}
|
|
378
|
-
if (featureFlags.enableViewUpdateSubscription) {
|
|
379
|
-
preset.add(viewUpdateSubscriptionPlugin);
|
|
380
|
-
}
|
|
381
|
-
preset.add([codeBidiWarningPlugin, {
|
|
382
|
-
appearance: props.appearance
|
|
383
|
-
}]);
|
|
384
|
-
if (featureFlags.floatingToolbarCopyButton) {
|
|
385
|
-
preset.add(copyButtonPlugin);
|
|
386
|
-
}
|
|
105
|
+
var preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance, createAnalyticsEvent, insertNodeAPI, editorAnalyticsAPI, editorSelectionAPI, getEditorContainerWidth);
|
|
387
106
|
var excludes = new Set();
|
|
388
107
|
if (!isCodeBlockAllowed({
|
|
389
108
|
allowBlockType: props.allowBlockType
|
package/dist/esm/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js
RENAMED
|
File without changes
|
package/dist/esm/editor.js
CHANGED
|
@@ -35,10 +35,10 @@ import { PortalProviderWithThemeProviders, PortalRenderer } from './ui/PortalPro
|
|
|
35
35
|
import { nextMajorVersion } from './version-wrapper';
|
|
36
36
|
import { ContextAdapter } from './nodeviews/context-adapter';
|
|
37
37
|
import measurements from './utils/performance/measure-enum';
|
|
38
|
-
import
|
|
38
|
+
import prepareQuickInsertProvider from './utils/prepare-quick-insert-provider';
|
|
39
39
|
import { fireAnalyticsEvent, EVENT_TYPE, ACTION_SUBJECT, ACTION } from './plugins/analytics';
|
|
40
40
|
import ErrorBoundary from './create-editor/ErrorBoundary';
|
|
41
|
-
import { createFeatureFlagsFromProps } from './
|
|
41
|
+
import { createFeatureFlagsFromProps } from './create-editor/feature-flags-from-props';
|
|
42
42
|
import { RenderTracking } from './utils/performance/components/RenderTracking';
|
|
43
43
|
var fullHeight = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n"])));
|
|
44
44
|
var Editor = /*#__PURE__*/function (_React$Component) {
|
|
@@ -59,9 +59,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
59
59
|
return combineExtensionProviders(extensionProviders);
|
|
60
60
|
}));
|
|
61
61
|
_defineProperty(_assertThisInitialized(_this), "prepareQuickInsertProvider", function (extensionProvider, quickInsert) {
|
|
62
|
-
|
|
63
|
-
var extensionQuickInsertProvider = extensionProvider && extensionProviderToQuickInsertProvider(extensionProvider, _this.editorActions, _this.createAnalyticsEvent);
|
|
64
|
-
return quickInsertProvider && extensionQuickInsertProvider ? combineQuickInsertProviders([quickInsertProvider, extensionQuickInsertProvider]) : quickInsertProvider || extensionQuickInsertProvider;
|
|
62
|
+
return prepareQuickInsertProvider(_this.editorActions, extensionProvider, quickInsert, _this.createAnalyticsEvent);
|
|
65
63
|
});
|
|
66
64
|
_defineProperty(_assertThisInitialized(_this), "handleSave", function (view) {
|
|
67
65
|
if (!_this.props.onSave) {
|
|
@@ -121,10 +119,10 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
121
119
|
}, (_props$performanceTra5 = props.performanceTracking) === null || _props$performanceTra5 === void 0 ? void 0 : (_props$performanceTra6 = _props$performanceTra5.ttiTracking) === null || _props$performanceTra6 === void 0 ? void 0 : _props$performanceTra6.ttiIdleThreshold, (_props$performanceTra7 = props.performanceTracking) === null || _props$performanceTra7 === void 0 ? void 0 : (_props$performanceTra8 = _props$performanceTra7.ttiTracking) === null || _props$performanceTra8 === void 0 ? void 0 : _props$performanceTra8.ttiCancelTimeout);
|
|
122
120
|
}
|
|
123
121
|
var _extensionProvider = _this.prepareExtensionProvider(props.extensionProviders);
|
|
124
|
-
var
|
|
122
|
+
var quickInsertProvider = _this.prepareQuickInsertProvider(_extensionProvider, props.quickInsert);
|
|
125
123
|
_this.state = {
|
|
126
124
|
extensionProvider: _extensionProvider,
|
|
127
|
-
quickInsertProvider:
|
|
125
|
+
quickInsertProvider: quickInsertProvider
|
|
128
126
|
};
|
|
129
127
|
return _this;
|
|
130
128
|
}
|