@atlaskit/editor-core 187.32.1 → 187.32.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 +2 -1
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/media/toolbar/index.js +2 -9
- package/dist/cjs/plugins/media/ui/PixelEntry/index.js +14 -25
- package/dist/cjs/plugins/media/utils/media-single.js +1 -1
- package/dist/cjs/ui/ContentStyles/index.js +13 -12
- package/dist/cjs/ui/styles.js +3 -5
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +2 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/media/toolbar/index.js +2 -9
- package/dist/es2019/plugins/media/ui/PixelEntry/index.js +14 -25
- package/dist/es2019/plugins/media/utils/media-single.js +2 -2
- package/dist/es2019/ui/ContentStyles/index.js +25 -3
- package/dist/es2019/ui/styles.js +0 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +2 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/media/toolbar/index.js +2 -9
- package/dist/esm/plugins/media/ui/PixelEntry/index.js +14 -25
- package/dist/esm/plugins/media/utils/media-single.js +2 -2
- package/dist/esm/ui/ContentStyles/index.js +6 -5
- package/dist/esm/ui/styles.js +2 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/media/ui/PixelEntry/index.d.ts +1 -1
- package/dist/types/plugins/media/ui/PixelEntry/types.d.ts +7 -2
- package/dist/types/ui/styles.d.ts +0 -1
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/media/ui/PixelEntry/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/ui/PixelEntry/types.d.ts +7 -2
- package/dist/types-ts4.5/ui/styles.d.ts +0 -1
- package/package.json +2 -2
- package/dist/cjs/plugins/emoji/commands/insert-emoji.js +0 -47
- package/dist/cjs/plugins/emoji/index.js +0 -409
- package/dist/cjs/plugins/emoji/messages.js +0 -15
- package/dist/cjs/plugins/emoji/nodeviews/emoji.js +0 -34
- package/dist/cjs/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -235
- package/dist/cjs/plugins/emoji/styles.js +0 -14
- package/dist/cjs/plugins/emoji/types.js +0 -5
- package/dist/cjs/plugins/emoji/ui/Emoji/index.js +0 -16
- package/dist/es2019/plugins/emoji/commands/insert-emoji.js +0 -40
- package/dist/es2019/plugins/emoji/index.js +0 -381
- package/dist/es2019/plugins/emoji/messages.js +0 -8
- package/dist/es2019/plugins/emoji/nodeviews/emoji.js +0 -29
- package/dist/es2019/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -169
- package/dist/es2019/plugins/emoji/styles.js +0 -25
- package/dist/es2019/plugins/emoji/types.js +0 -1
- package/dist/es2019/plugins/emoji/ui/Emoji/index.js +0 -9
- package/dist/esm/plugins/emoji/commands/insert-emoji.js +0 -39
- package/dist/esm/plugins/emoji/index.js +0 -391
- package/dist/esm/plugins/emoji/messages.js +0 -8
- package/dist/esm/plugins/emoji/nodeviews/emoji.js +0 -27
- package/dist/esm/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -225
- package/dist/esm/plugins/emoji/styles.js +0 -6
- package/dist/esm/plugins/emoji/types.js +0 -1
- package/dist/esm/plugins/emoji/ui/Emoji/index.js +0 -9
- package/dist/types/plugins/emoji/commands/insert-emoji.d.ts +0 -4
- package/dist/types/plugins/emoji/index.d.ts +0 -40
- package/dist/types/plugins/emoji/messages.d.ts +0 -7
- package/dist/types/plugins/emoji/nodeviews/emoji.d.ts +0 -7
- package/dist/types/plugins/emoji/pm-plugins/ascii-input-rules.d.ts +0 -10
- package/dist/types/plugins/emoji/styles.d.ts +0 -1
- package/dist/types/plugins/emoji/types.d.ts +0 -1
- package/dist/types/plugins/emoji/ui/Emoji/index.d.ts +0 -4
- package/dist/types-ts4.5/plugins/emoji/commands/insert-emoji.d.ts +0 -4
- package/dist/types-ts4.5/plugins/emoji/index.d.ts +0 -40
- package/dist/types-ts4.5/plugins/emoji/messages.d.ts +0 -7
- package/dist/types-ts4.5/plugins/emoji/nodeviews/emoji.d.ts +0 -7
- package/dist/types-ts4.5/plugins/emoji/pm-plugins/ascii-input-rules.d.ts +0 -10
- package/dist/types-ts4.5/plugins/emoji/styles.d.ts +0 -1
- package/dist/types-ts4.5/plugins/emoji/types.d.ts +0 -1
- package/dist/types-ts4.5/plugins/emoji/ui/Emoji/index.d.ts +0 -4
|
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import { safeInsert as pmSafeInsert, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { checkNodeDown } from '../../../utils';
|
|
7
|
-
import { getMediaSingleInitialWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
7
|
+
import { getMediaSingleInitialWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
|
|
8
8
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
|
|
10
10
|
import { mapSlice } from '../../../utils/slice';
|
|
@@ -91,7 +91,7 @@ export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaSta
|
|
|
91
91
|
|
|
92
92
|
// add undefined as fallback as we don't want media single width to have upper limit as 0
|
|
93
93
|
// if widthPluginState.width is 0, default 760 will be used
|
|
94
|
-
var contentWidth = (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
|
|
94
|
+
var contentWidth = getMaxWidthForNestedNodeNext(view, state.selection.$from.pos, true) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
|
|
95
95
|
var node = createMediaSingleNode(state.schema, collection, contentWidth, mediaState.status !== 'error' && isVideo(mediaState.fileMimeType) ? MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, alignLeftOnInsert)(mediaState);
|
|
96
96
|
var fileExtension;
|
|
97
97
|
if (mediaState.fileName) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React, { useMemo } from 'react';
|
|
5
5
|
import { jsx, css, useTheme } from '@emotion/react';
|
|
6
6
|
import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles, gridStyles, smartCardStyles, embedCardStyles, codeBlockInListSafariFix, unsupportedStyles } from '@atlaskit/editor-common/styles';
|
|
7
|
-
import { blockNodesVerticalMargin, editorFontSize } from '@atlaskit/editor-shared-styles';
|
|
7
|
+
import { akEditorSelectedNodeClassName, blockNodesVerticalMargin, editorFontSize, getSelectionStyles, SelectionStyle } from '@atlaskit/editor-shared-styles';
|
|
8
8
|
import { telepointerStyle } from '../../plugins/collab-edit/styles';
|
|
9
9
|
import { gapCursorStyles } from '../../plugins/selection/gap-cursor/styles';
|
|
10
10
|
import { tableStyles } from '@atlaskit/editor-plugin-table/ui/common-styles';
|
|
@@ -17,7 +17,6 @@ import { layoutStyles } from '../../plugins/layout/styles';
|
|
|
17
17
|
import { panelStyles } from '../../plugins/panel/styles';
|
|
18
18
|
import { fakeCursorStyles } from '../../plugins/fake-text-cursor/styles';
|
|
19
19
|
import { mentionsStyles } from '../../plugins/mentions/styles';
|
|
20
|
-
import { emojiStyles } from '../../plugins/emoji/styles';
|
|
21
20
|
import { placeholderTextStyles } from '../../plugins/placeholder-text/styles';
|
|
22
21
|
import { extensionStyles } from '../../plugins/extension/ui/styles';
|
|
23
22
|
import { expandStyles } from '../../plugins/expand/ui/styles';
|
|
@@ -29,10 +28,12 @@ import { dateStyles } from '../../plugins/date/styles';
|
|
|
29
28
|
import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';
|
|
30
29
|
import { linkSharedStyle, codeMarkSharedStyles } from '@atlaskit/editor-common/styles';
|
|
31
30
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
31
|
+
import { EmojiSharedCssClassName } from '@atlaskit/editor-common/emoji';
|
|
32
32
|
export var linkStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n ", "\n }\n"])), linkSharedStyle);
|
|
33
|
-
var listsStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror {\n li {\n position: relative;\n\n > p:not(:first-child) {\n margin:
|
|
33
|
+
var listsStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror {\n li {\n position: relative;\n\n > p:not(:first-child) {\n margin: ", " 0 0 0;\n }\n\n // In SSR the above rule will apply to all p tags because first-child would be a style tag.\n // The following rule resets the first p tag back to its original margin\n // defined in packages/editor/editor-common/src/styles/shared/paragraph.ts\n > style:first-child + p {\n margin-top: ", ";\n }\n }\n\n & :not([data-node-type='decisionList']) > li {\n ", "\n }\n }\n"])), "var(--ds-space-050, 4px)", blockNodesVerticalMargin, browser.safari ? codeBlockInListSafariFix : '');
|
|
34
|
+
var emojiStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\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"])), EmojiSharedCssClassName.EMOJI_CONTAINER, EmojiSharedCssClassName.EMOJI_NODE, EmojiSharedCssClassName.EMOJI_IMAGE, akEditorSelectedNodeClassName, EmojiSharedCssClassName.EMOJI_SPRITE, EmojiSharedCssClassName.EMOJI_IMAGE, getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.BoxShadow]));
|
|
34
35
|
var contentStyles = function contentStyles(props) {
|
|
35
|
-
return css(
|
|
36
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\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"])), editorFontSize({
|
|
36
37
|
theme: props.theme
|
|
37
38
|
}), whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, shadowSharedStyle, InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", placeholderTextStyles, placeholderStyles, codeBlockStyles(props), blocktypeStyles(props), codeMarkSharedStyles(props), textColorStyles, listsStyles, ruleStyles(props), mediaStyles, layoutStyles(props), telepointerStyle, gapCursorStyles, tableStyles(props), panelStyles(props), fakeCursorStyles, mentionsStyles, emojiStyles, tasksAndDecisionsStyles, gridStyles, linkStyles, blockMarksSharedStyles, dateSharedStyle, extensionStyles, expandStyles(props), findReplaceStyles, taskDecisionStyles, statusStyles, annotationSharedStyles(props), smartCardStyles, smartCardSharedStyles, dateStyles, embedCardStyles, unsupportedStyles, resizerStyles, ClassNames.FLOATING_TOOLBAR_COMPONENT);
|
|
38
39
|
};
|
package/dist/esm/ui/styles.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject
|
|
2
|
+
var _templateObject;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
export { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
5
5
|
export { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
6
|
-
export var expandIconWrapperStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-left: -8px;\n"])));
|
|
7
|
-
export var clickSelectWrapperStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n user-select: all;\n"])));
|
|
6
|
+
export var expandIconWrapperStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-left: -8px;\n"])));
|
|
@@ -7,7 +7,6 @@ export { default as clearMarksOnChangeToEmptyDocumentPlugin } from './clear-mark
|
|
|
7
7
|
export { default as codeBlockPlugin } from './code-block';
|
|
8
8
|
export { default as collabEditPlugin } from './collab-edit';
|
|
9
9
|
export { default as datePlugin } from './date';
|
|
10
|
-
export { emojiPlugin } from './emoji';
|
|
11
10
|
export { default as extensionPlugin } from './extension';
|
|
12
11
|
export { default as fakeTextCursorPlugin } from './fake-text-cursor';
|
|
13
12
|
export { default as helpDialogPlugin } from './help-dialog';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import type { IntlShape } from 'react-intl-next';
|
|
5
5
|
import type { PixelEntryProps } from './types';
|
|
6
|
-
export declare const PixelEntry: ({ width, mediaWidth, mediaHeight, onSubmit,
|
|
6
|
+
export declare const PixelEntry: ({ width, mediaWidth, mediaHeight, onSubmit, minWidth, maxWidth, onChange, intl: { formatMessage }, showMigration, onMigrate, }: PixelEntryProps) => jsx.JSX.Element;
|
|
7
7
|
export declare const FullWidthDisplay: React.FC<{
|
|
8
8
|
intl: IntlShape;
|
|
9
9
|
}>;
|
|
@@ -24,6 +24,11 @@ export type PixelEntryProps = {
|
|
|
24
24
|
* The maximum acceptable width input
|
|
25
25
|
*/
|
|
26
26
|
maxWidth: number;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* Handler for valid input
|
|
30
|
+
*/
|
|
31
|
+
onChange?: (valid: boolean) => void;
|
|
27
32
|
/**
|
|
28
33
|
* show migration button to convert to pixels for legacy image resize experience
|
|
29
34
|
*/
|
|
@@ -43,8 +48,8 @@ export type PixelEntryProps = {
|
|
|
43
48
|
onMigrate?: () => void;
|
|
44
49
|
};
|
|
45
50
|
export type PixelEntryFormValues = {
|
|
46
|
-
inputWidth: number;
|
|
47
|
-
inputHeight: number;
|
|
51
|
+
inputWidth: number | '';
|
|
52
|
+
inputHeight: number | '';
|
|
48
53
|
};
|
|
49
54
|
export type PixelEntryFormData = {
|
|
50
55
|
width: number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
2
2
|
export { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
3
3
|
export declare const expandIconWrapperStyle: import("@emotion/react").SerializedStyles;
|
|
4
|
-
export declare const clickSelectWrapperStyle: import("@emotion/react").SerializedStyles;
|
|
@@ -7,7 +7,6 @@ export { default as clearMarksOnChangeToEmptyDocumentPlugin } from './clear-mark
|
|
|
7
7
|
export { default as codeBlockPlugin } from './code-block';
|
|
8
8
|
export { default as collabEditPlugin } from './collab-edit';
|
|
9
9
|
export { default as datePlugin } from './date';
|
|
10
|
-
export { emojiPlugin } from './emoji';
|
|
11
10
|
export { default as extensionPlugin } from './extension';
|
|
12
11
|
export { default as fakeTextCursorPlugin } from './fake-text-cursor';
|
|
13
12
|
export { default as helpDialogPlugin } from './help-dialog';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import type { IntlShape } from 'react-intl-next';
|
|
5
5
|
import type { PixelEntryProps } from './types';
|
|
6
|
-
export declare const PixelEntry: ({ width, mediaWidth, mediaHeight, onSubmit,
|
|
6
|
+
export declare const PixelEntry: ({ width, mediaWidth, mediaHeight, onSubmit, minWidth, maxWidth, onChange, intl: { formatMessage }, showMigration, onMigrate, }: PixelEntryProps) => jsx.JSX.Element;
|
|
7
7
|
export declare const FullWidthDisplay: React.FC<{
|
|
8
8
|
intl: IntlShape;
|
|
9
9
|
}>;
|
|
@@ -24,6 +24,11 @@ export type PixelEntryProps = {
|
|
|
24
24
|
* The maximum acceptable width input
|
|
25
25
|
*/
|
|
26
26
|
maxWidth: number;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* Handler for valid input
|
|
30
|
+
*/
|
|
31
|
+
onChange?: (valid: boolean) => void;
|
|
27
32
|
/**
|
|
28
33
|
* show migration button to convert to pixels for legacy image resize experience
|
|
29
34
|
*/
|
|
@@ -43,8 +48,8 @@ export type PixelEntryProps = {
|
|
|
43
48
|
onMigrate?: () => void;
|
|
44
49
|
};
|
|
45
50
|
export type PixelEntryFormValues = {
|
|
46
|
-
inputWidth: number;
|
|
47
|
-
inputHeight: number;
|
|
51
|
+
inputWidth: number | '';
|
|
52
|
+
inputHeight: number | '';
|
|
48
53
|
};
|
|
49
54
|
export type PixelEntryFormData = {
|
|
50
55
|
width: number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
2
2
|
export { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
3
3
|
export declare const expandIconWrapperStyle: import("@emotion/react").SerializedStyles;
|
|
4
|
-
export declare const clickSelectWrapperStyle: import("@emotion/react").SerializedStyles;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.32.
|
|
3
|
+
"version": "187.32.3",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@atlaskit/editor-plugin-context-panel": "^0.1.0",
|
|
67
67
|
"@atlaskit/editor-plugin-decorations": "^0.1.0",
|
|
68
68
|
"@atlaskit/editor-plugin-editor-disabled": "^0.1.0",
|
|
69
|
-
"@atlaskit/editor-plugin-emoji": "^0.
|
|
69
|
+
"@atlaskit/editor-plugin-emoji": "^0.2.0",
|
|
70
70
|
"@atlaskit/editor-plugin-feature-flags": "^0.1.0",
|
|
71
71
|
"@atlaskit/editor-plugin-floating-toolbar": "^0.3.0",
|
|
72
72
|
"@atlaskit/editor-plugin-focus": "^0.1.0",
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.insertEmoji = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
10
|
-
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
11
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
|
-
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; }
|
|
14
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
15
|
-
var insertEmoji = function insertEmoji(editorAnalyticsAPI) {
|
|
16
|
-
return function (emojiId, inputMethod) {
|
|
17
|
-
return function (_ref) {
|
|
18
|
-
var tr = _ref.tr;
|
|
19
|
-
var doc = tr.doc,
|
|
20
|
-
selection = tr.selection;
|
|
21
|
-
var emoji = tr.doc.type.schema.nodes.emoji;
|
|
22
|
-
if (emoji && emojiId) {
|
|
23
|
-
var node = emoji.createChecked(_objectSpread(_objectSpread({}, emojiId), {}, {
|
|
24
|
-
text: emojiId.fallback || emojiId.shortName
|
|
25
|
-
}));
|
|
26
|
-
var textNode = doc.type.schema.text(' ');
|
|
27
|
-
var fragment = _model.Fragment.fromArray([node, textNode]);
|
|
28
|
-
var newTr = (0, _utils.safeInsert)(fragment)(tr);
|
|
29
|
-
if (inputMethod) {
|
|
30
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
31
|
-
action: _analytics.ACTION.INSERTED,
|
|
32
|
-
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
33
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.EMOJI,
|
|
34
|
-
attributes: {
|
|
35
|
-
inputMethod: inputMethod
|
|
36
|
-
},
|
|
37
|
-
eventType: _analytics.EVENT_TYPE.TRACK
|
|
38
|
-
})(newTr);
|
|
39
|
-
}
|
|
40
|
-
newTr.setSelection(_state.Selection.near(newTr.doc.resolve(selection.$from.pos + fragment.size)));
|
|
41
|
-
return newTr;
|
|
42
|
-
}
|
|
43
|
-
return null;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
exports.insertEmoji = insertEmoji;
|