@atlaskit/editor-plugin-paste-options-toolbar 1.4.3 → 1.4.5
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 +14 -0
- package/dist/cjs/{commands.js → editor-commands/commands.js} +4 -4
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/{plugin.js → pasteOptionsToolbarPlugin.js} +3 -3
- package/dist/cjs/pasteOptionsToolbarPluginType.js +5 -0
- package/dist/cjs/pm-plugins/main.js +2 -2
- package/dist/cjs/pm-plugins/plugin-factory.js +3 -3
- package/dist/cjs/{reducer.js → pm-plugins/reducer.js} +1 -1
- package/dist/cjs/{util → pm-plugins/util}/format-handlers.js +5 -0
- package/dist/cjs/{util → pm-plugins/util}/index.js +4 -0
- package/dist/cjs/ui/paste-icon.js +5 -0
- package/dist/cjs/{toolbar.js → ui/toolbar.js} +15 -6
- package/dist/es2019/{commands.js → editor-commands/commands.js} +4 -4
- package/dist/es2019/index.js +4 -1
- package/dist/es2019/{plugin.js → pasteOptionsToolbarPlugin.js} +3 -3
- package/dist/es2019/pasteOptionsToolbarPluginType.js +1 -0
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/es2019/pm-plugins/plugin-factory.js +3 -3
- package/dist/es2019/{reducer.js → pm-plugins/reducer.js} +1 -1
- package/dist/es2019/{util → pm-plugins/util}/format-handlers.js +5 -0
- package/dist/es2019/{util → pm-plugins/util}/index.js +4 -0
- package/dist/es2019/ui/paste-icon.js +5 -0
- package/dist/es2019/{toolbar.js → ui/toolbar.js} +15 -6
- package/dist/esm/{commands.js → editor-commands/commands.js} +4 -4
- package/dist/esm/index.js +4 -1
- package/dist/esm/{plugin.js → pasteOptionsToolbarPlugin.js} +3 -3
- package/dist/esm/pasteOptionsToolbarPluginType.js +1 -0
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/esm/pm-plugins/plugin-factory.js +3 -3
- package/dist/esm/{reducer.js → pm-plugins/reducer.js} +1 -1
- package/dist/esm/{util → pm-plugins/util}/format-handlers.js +5 -0
- package/dist/esm/{util → pm-plugins/util}/index.js +4 -0
- package/dist/esm/ui/paste-icon.js +5 -0
- package/dist/esm/{toolbar.js → ui/toolbar.js} +15 -6
- package/dist/{types-ts4.5 → types/editor-actions}/actions.d.ts +1 -1
- package/dist/types/{commands.d.ts → editor-commands/commands.d.ts} +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/pasteOptionsToolbarPlugin.d.ts +2 -0
- package/dist/types/{plugin.d.ts → pasteOptionsToolbarPluginType.d.ts} +0 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/plugin-factory.d.ts +2 -2
- package/dist/types/pm-plugins/reducer.d.ts +3 -0
- package/dist/types/{util → pm-plugins/util}/format-handlers.d.ts +1 -1
- package/dist/types/{toolbar.d.ts → ui/toolbar.d.ts} +1 -1
- package/dist/{types → types-ts4.5/editor-actions}/actions.d.ts +1 -1
- package/dist/types-ts4.5/{commands.d.ts → editor-commands/commands.d.ts} +1 -1
- package/dist/types-ts4.5/index.d.ts +2 -2
- package/dist/types-ts4.5/pasteOptionsToolbarPlugin.d.ts +2 -0
- package/dist/types-ts4.5/{plugin.d.ts → pasteOptionsToolbarPluginType.d.ts} +0 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/plugin-factory.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/reducer.d.ts +3 -0
- package/dist/types-ts4.5/{util → pm-plugins/util}/format-handlers.d.ts +1 -1
- package/dist/types-ts4.5/{toolbar.d.ts → ui/toolbar.d.ts} +1 -1
- package/package.json +6 -6
- package/styles/package.json +5 -5
- package/dist/cjs/styles.js +0 -12
- package/dist/es2019/styles.js +0 -1
- package/dist/esm/styles.js +0 -1
- package/dist/types/reducer.d.ts +0 -3
- package/dist/types/styles.d.ts +0 -1
- package/dist/types-ts4.5/reducer.d.ts +0 -3
- package/dist/types-ts4.5/styles.d.ts +0 -1
- /package/dist/cjs/{actions.js → editor-actions/actions.js} +0 -0
- /package/dist/cjs/{types.js → types/types.js} +0 -0
- /package/dist/es2019/{actions.js → editor-actions/actions.js} +0 -0
- /package/dist/es2019/{types.js → types/types.js} +0 -0
- /package/dist/esm/{actions.js → editor-actions/actions.js} +0 -0
- /package/dist/esm/{types.js → types/types.js} +0 -0
- /package/dist/types/{util → pm-plugins/util}/index.d.ts +0 -0
- /package/dist/types/{types.d.ts → types/types.d.ts} +0 -0
- /package/dist/types-ts4.5/{util → pm-plugins/util}/index.d.ts +0 -0
- /package/dist/types-ts4.5/{types.d.ts → types/types.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste-options-toolbar
|
|
2
2
|
|
|
3
|
+
## 1.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#99019](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99019)
|
|
8
|
+
[`40d07b40b2031`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/40d07b40b2031) -
|
|
9
|
+
ED-25888: Add lint rule to enforce editor plugin structure
|
|
10
|
+
|
|
11
|
+
## 1.4.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 1.4.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.showToolbar = exports.highlightContent = exports.hideToolbar = exports.dropdownClickHandler = exports.checkAndHideToolbar = exports.changeToRichTextWithAnalytics = exports.changeToRichText = exports.changeToPlainTextWithAnalytics = exports.changeToPlainText = exports.changeToMarkdownWithAnalytics = exports.changeToMarkDown = void 0;
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
8
|
var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
9
|
-
var _actions = require("
|
|
10
|
-
var _pluginFactory = require("
|
|
11
|
-
var
|
|
12
|
-
var
|
|
9
|
+
var _actions = require("../editor-actions/actions");
|
|
10
|
+
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
11
|
+
var _formatHandlers = require("../pm-plugins/util/format-handlers");
|
|
12
|
+
var _types = require("../types/types");
|
|
13
13
|
var showToolbar = exports.showToolbar = function showToolbar(lastContentPasted, selectedOption) {
|
|
14
14
|
var commandAction = function commandAction(editorState) {
|
|
15
15
|
return {
|
package/dist/cjs/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "pasteOptionsToolbarPlugin", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return
|
|
9
|
+
return _pasteOptionsToolbarPlugin.pasteOptionsToolbarPlugin;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var
|
|
12
|
+
var _pasteOptionsToolbarPlugin = require("./pasteOptionsToolbarPlugin");
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.pasteOptionsToolbarPlugin = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
9
|
-
var _commands = require("./commands");
|
|
9
|
+
var _commands = require("./editor-commands/commands");
|
|
10
10
|
var _main = require("./pm-plugins/main");
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var _types = require("./types/types");
|
|
12
|
+
var _toolbar = require("./ui/toolbar");
|
|
13
13
|
var pasteOptionsToolbarPlugin = exports.pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref) {
|
|
14
14
|
var _api$analytics;
|
|
15
15
|
var config = _ref.config,
|
|
@@ -7,8 +7,8 @@ exports.createPlugin = createPlugin;
|
|
|
7
7
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
8
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
9
9
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
10
|
-
var _commands = require("../commands");
|
|
11
|
-
var _types = require("../types");
|
|
10
|
+
var _commands = require("../editor-commands/commands");
|
|
11
|
+
var _types = require("../types/types");
|
|
12
12
|
var _constants = require("./constants");
|
|
13
13
|
var _pluginFactory = require("./plugin-factory");
|
|
14
14
|
function createPlugin(dispatch) {
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getPluginState = exports.createPluginState = exports.createCommand = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
10
|
-
var _actions = require("../actions");
|
|
11
|
-
var
|
|
12
|
-
var _types = require("../types");
|
|
10
|
+
var _actions = require("../editor-actions/actions");
|
|
11
|
+
var _types = require("../types/types");
|
|
13
12
|
var _constants = require("./constants");
|
|
13
|
+
var _reducer = require("./reducer");
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
16
|
var _pluginFactory = (0, _utils.pluginFactory)(_types.pasteOptionsPluginKey, _reducer.reducer, {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.reducer = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _actions = require("
|
|
9
|
+
var _actions = require("../editor-actions/actions");
|
|
10
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
12
|
var reducer = exports.reducer = function reducer(state, action) {
|
|
@@ -150,9 +150,14 @@ function getMarkdownSlice(text, schema, selection) {
|
|
|
150
150
|
try {
|
|
151
151
|
var _doc$content$firstChi, _doc$content$lastChil;
|
|
152
152
|
var textInput = text;
|
|
153
|
+
|
|
154
|
+
// Ignored via go/ees005
|
|
155
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
153
156
|
var textSplitByCodeBlock = textInput.split(/```/);
|
|
154
157
|
for (var i = 0; i < textSplitByCodeBlock.length; i++) {
|
|
155
158
|
if (i % 2 === 0) {
|
|
159
|
+
// Ignored via go/ees005
|
|
160
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
156
161
|
textSplitByCodeBlock[i] = textSplitByCodeBlock[i].replace(/\\/g, '\\\\');
|
|
157
162
|
}
|
|
158
163
|
}
|
|
@@ -13,7 +13,11 @@ function isPastedFromFabricEditor(pastedFrom) {
|
|
|
13
13
|
// @see https://product-fabric.atlassian.net/browse/ED-3159
|
|
14
14
|
// @see https://github.com/markdown-it/markdown-it/issues/38
|
|
15
15
|
function escapeLinks(text) {
|
|
16
|
+
// Ignored via go/ees005
|
|
17
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
16
18
|
return text.replace(/(\[([^\]]+)\]\()?((https?|ftp|jamfselfservice):\/\/[^\s"'>]+)/g, function (str) {
|
|
19
|
+
// Ignored via go/ees005
|
|
20
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
17
21
|
return str.match(/^(https?|ftp|jamfselfservice):\/\/[^\s"'>]+$/) ? "<".concat(str, ">") : str;
|
|
18
22
|
});
|
|
19
23
|
}
|
|
@@ -17,6 +17,8 @@ var CustomGlyph = function CustomGlyph(props) {
|
|
|
17
17
|
viewBox: "0 0 24 24",
|
|
18
18
|
fill: "none",
|
|
19
19
|
xmlns: "http://www.w3.org/2000/svg"
|
|
20
|
+
// Ignored via go/ees005
|
|
21
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
20
22
|
}, props), /*#__PURE__*/_react.default.createElement("path", {
|
|
21
23
|
fillRule: "evenodd",
|
|
22
24
|
clipRule: "evenodd",
|
|
@@ -38,6 +40,9 @@ var CustomGlyph = function CustomGlyph(props) {
|
|
|
38
40
|
fill: "currentColor"
|
|
39
41
|
}));
|
|
40
42
|
};
|
|
43
|
+
|
|
44
|
+
// Ignored via go/ees005
|
|
45
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
41
46
|
var EditorPasteIcon = function EditorPasteIcon(props) {
|
|
42
47
|
return /*#__PURE__*/_react.default.createElement(_icon.default, (0, _extends2.default)({}, props, {
|
|
43
48
|
glyph: CustomGlyph
|
|
@@ -7,11 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.isToolbarVisible = exports.getToolbarMenuConfig = exports.buildToolbar = void 0;
|
|
8
8
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
9
9
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
10
|
-
var _commands = require("
|
|
11
|
-
var _constants = require("
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
10
|
+
var _commands = require("../editor-commands/commands");
|
|
11
|
+
var _constants = require("../pm-plugins/constants");
|
|
12
|
+
var _util = require("../pm-plugins/util");
|
|
13
|
+
var _types = require("../types/types");
|
|
14
|
+
var _pasteIcon = _interopRequireDefault(require("./paste-icon"));
|
|
15
15
|
var isToolbarVisible = exports.isToolbarVisible = function isToolbarVisible(state, lastContentPasted) {
|
|
16
16
|
var _$from$parent, _$from$node, _state$schema$nodes$c;
|
|
17
17
|
/**
|
|
@@ -81,6 +81,9 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, edi
|
|
|
81
81
|
var onPositionCalculated = function onPositionCalculated(editorView, nextPos) {
|
|
82
82
|
var from = editorView.state.selection.from;
|
|
83
83
|
var fromCoords = editorView.coordsAtPos(from);
|
|
84
|
+
|
|
85
|
+
// Ignored via go/ees005
|
|
86
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
84
87
|
var toolbar = document.querySelector("div[aria-label=\"".concat(_messages.pasteOptionsToolbarMessages.pasteOptions.defaultMessage, "\"]"));
|
|
85
88
|
var offsetParent = (toolbar === null || toolbar === void 0 ? void 0 : toolbar.offsetParent) || editorView.dom;
|
|
86
89
|
var offsetParentRect = offsetParent === null || offsetParent === void 0 ? void 0 : offsetParent.getBoundingClientRect();
|
|
@@ -95,6 +98,12 @@ var onPositionCalculated = function onPositionCalculated(editorView, nextPos) {
|
|
|
95
98
|
};
|
|
96
99
|
var getCursorHeight = function getCursorHeight(editorView, from) {
|
|
97
100
|
var nodeAtFrom = editorView.domAtPos(from).node;
|
|
98
|
-
var nearestNonTextNode = (nodeAtFrom === null || nodeAtFrom === void 0 ? void 0 : nodeAtFrom.nodeType) === Node.TEXT_NODE ?
|
|
101
|
+
var nearestNonTextNode = (nodeAtFrom === null || nodeAtFrom === void 0 ? void 0 : nodeAtFrom.nodeType) === Node.TEXT_NODE ?
|
|
102
|
+
// Ignored via go/ees005
|
|
103
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
104
|
+
nodeAtFrom.parentNode :
|
|
105
|
+
// Ignored via go/ees005
|
|
106
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
107
|
+
nodeAtFrom;
|
|
99
108
|
return parseFloat(window.getComputedStyle(nearestNonTextNode, undefined).lineHeight || '');
|
|
100
109
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, PasteContents, PasteTypes } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
3
|
-
import { PastePluginActionTypes as ActionTypes } from '
|
|
4
|
-
import { createCommand } from '
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { PastePluginActionTypes as ActionTypes } from '../editor-actions/actions';
|
|
4
|
+
import { createCommand } from '../pm-plugins/plugin-factory';
|
|
5
|
+
import { formatMarkdown, formatPlainText, formatRichText } from '../pm-plugins/util/format-handlers';
|
|
6
|
+
import { pasteOptionsPluginKey, ToolbarDropdownOption } from '../types/types';
|
|
7
7
|
export const showToolbar = (lastContentPasted, selectedOption) => {
|
|
8
8
|
const commandAction = editorState => {
|
|
9
9
|
return {
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
-
import { hideToolbar, showToolbar } from './commands';
|
|
3
|
+
import { hideToolbar, showToolbar } from './editor-commands/commands';
|
|
4
4
|
import { createPlugin } from './pm-plugins/main';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { pasteOptionsPluginKey, ToolbarDropdownOption } from './types/types';
|
|
6
|
+
import { buildToolbar, isToolbarVisible } from './ui/toolbar';
|
|
7
7
|
export const pasteOptionsToolbarPlugin = ({
|
|
8
8
|
config,
|
|
9
9
|
api
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import { checkAndHideToolbar } from '../commands';
|
|
5
|
-
import { pasteOptionsPluginKey, ToolbarDropdownOption } from '../types';
|
|
4
|
+
import { checkAndHideToolbar } from '../editor-commands/commands';
|
|
5
|
+
import { pasteOptionsPluginKey, ToolbarDropdownOption } from '../types/types';
|
|
6
6
|
import { PASTE_HIGHLIGHT_DECORATION_KEY, TEXT_HIGHLIGHT_CLASS } from './constants';
|
|
7
7
|
import { createPluginState } from './plugin-factory';
|
|
8
8
|
export function createPlugin(dispatch) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
2
|
-
import { PastePluginActionTypes } from '../actions';
|
|
3
|
-
import {
|
|
4
|
-
import { pasteOptionsPluginKey } from '../types';
|
|
2
|
+
import { PastePluginActionTypes } from '../editor-actions/actions';
|
|
3
|
+
import { pasteOptionsPluginKey } from '../types/types';
|
|
5
4
|
import { PASTE_OPTIONS_META_ID } from './constants';
|
|
5
|
+
import { reducer } from './reducer';
|
|
6
6
|
export const {
|
|
7
7
|
createPluginState,
|
|
8
8
|
createCommand,
|
|
@@ -145,9 +145,14 @@ export function getMarkdownSlice(text, schema, selection) {
|
|
|
145
145
|
try {
|
|
146
146
|
var _doc$content$firstChi, _doc$content$lastChil;
|
|
147
147
|
let textInput = text;
|
|
148
|
+
|
|
149
|
+
// Ignored via go/ees005
|
|
150
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
148
151
|
const textSplitByCodeBlock = textInput.split(/```/);
|
|
149
152
|
for (let i = 0; i < textSplitByCodeBlock.length; i++) {
|
|
150
153
|
if (i % 2 === 0) {
|
|
154
|
+
// Ignored via go/ees005
|
|
155
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
151
156
|
textSplitByCodeBlock[i] = textSplitByCodeBlock[i].replace(/\\/g, '\\\\');
|
|
152
157
|
}
|
|
153
158
|
}
|
|
@@ -5,7 +5,11 @@ export function isPastedFromFabricEditor(pastedFrom) {
|
|
|
5
5
|
// @see https://product-fabric.atlassian.net/browse/ED-3159
|
|
6
6
|
// @see https://github.com/markdown-it/markdown-it/issues/38
|
|
7
7
|
export function escapeLinks(text) {
|
|
8
|
+
// Ignored via go/ees005
|
|
9
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
8
10
|
return text.replace(/(\[([^\]]+)\]\()?((https?|ftp|jamfselfservice):\/\/[^\s"'>]+)/g, str => {
|
|
11
|
+
// Ignored via go/ees005
|
|
12
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
9
13
|
return str.match(/^(https?|ftp|jamfselfservice):\/\/[^\s"'>]+$/) ? `<${str}>` : str;
|
|
10
14
|
});
|
|
11
15
|
}
|
|
@@ -9,6 +9,8 @@ const CustomGlyph = props => /*#__PURE__*/React.createElement("svg", _extends({
|
|
|
9
9
|
viewBox: "0 0 24 24",
|
|
10
10
|
fill: "none",
|
|
11
11
|
xmlns: "http://www.w3.org/2000/svg"
|
|
12
|
+
// Ignored via go/ees005
|
|
13
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
12
14
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
13
15
|
fillRule: "evenodd",
|
|
14
16
|
clipRule: "evenodd",
|
|
@@ -29,6 +31,9 @@ const CustomGlyph = props => /*#__PURE__*/React.createElement("svg", _extends({
|
|
|
29
31
|
rx: "1",
|
|
30
32
|
fill: "currentColor"
|
|
31
33
|
}));
|
|
34
|
+
|
|
35
|
+
// Ignored via go/ees005
|
|
36
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
32
37
|
const EditorPasteIcon = props => /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
33
38
|
glyph: CustomGlyph
|
|
34
39
|
}));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { pasteOptionsToolbarMessages as messages } from '@atlaskit/editor-common/messages';
|
|
2
2
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
3
|
-
import { changeToMarkdownWithAnalytics, changeToPlainTextWithAnalytics, changeToRichTextWithAnalytics, dropdownClickHandler } from '
|
|
4
|
-
import { PASTE_OPTIONS_TEST_ID, PASTE_TOOLBAR_CLASS, PASTE_TOOLBAR_ITEM_CLASS } from '
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
3
|
+
import { changeToMarkdownWithAnalytics, changeToPlainTextWithAnalytics, changeToRichTextWithAnalytics, dropdownClickHandler } from '../editor-commands/commands';
|
|
4
|
+
import { PASTE_OPTIONS_TEST_ID, PASTE_TOOLBAR_CLASS, PASTE_TOOLBAR_ITEM_CLASS } from '../pm-plugins/constants';
|
|
5
|
+
import { hasLinkMark, hasMediaNode, hasRuleNode, isPastedFromFabricEditor } from '../pm-plugins/util';
|
|
6
|
+
import { pasteOptionsPluginKey, ToolbarDropdownOption } from '../types/types';
|
|
7
|
+
import EditorPasteIcon from './paste-icon';
|
|
8
8
|
export const isToolbarVisible = (state, lastContentPasted) => {
|
|
9
9
|
var _$from$parent, _$from$node, _state$schema$nodes$c;
|
|
10
10
|
/**
|
|
@@ -78,6 +78,9 @@ const onPositionCalculated = (editorView, nextPos) => {
|
|
|
78
78
|
from
|
|
79
79
|
} = editorView.state.selection;
|
|
80
80
|
const fromCoords = editorView.coordsAtPos(from);
|
|
81
|
+
|
|
82
|
+
// Ignored via go/ees005
|
|
83
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
81
84
|
const toolbar = document.querySelector(`div[aria-label="${messages.pasteOptions.defaultMessage}"]`);
|
|
82
85
|
const offsetParent = (toolbar === null || toolbar === void 0 ? void 0 : toolbar.offsetParent) || editorView.dom;
|
|
83
86
|
const offsetParentRect = offsetParent === null || offsetParent === void 0 ? void 0 : offsetParent.getBoundingClientRect();
|
|
@@ -92,6 +95,12 @@ const onPositionCalculated = (editorView, nextPos) => {
|
|
|
92
95
|
};
|
|
93
96
|
const getCursorHeight = (editorView, from) => {
|
|
94
97
|
const nodeAtFrom = editorView.domAtPos(from).node;
|
|
95
|
-
const nearestNonTextNode = (nodeAtFrom === null || nodeAtFrom === void 0 ? void 0 : nodeAtFrom.nodeType) === Node.TEXT_NODE ?
|
|
98
|
+
const nearestNonTextNode = (nodeAtFrom === null || nodeAtFrom === void 0 ? void 0 : nodeAtFrom.nodeType) === Node.TEXT_NODE ?
|
|
99
|
+
// Ignored via go/ees005
|
|
100
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
101
|
+
nodeAtFrom.parentNode :
|
|
102
|
+
// Ignored via go/ees005
|
|
103
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
104
|
+
nodeAtFrom;
|
|
96
105
|
return parseFloat(window.getComputedStyle(nearestNonTextNode, undefined).lineHeight || '');
|
|
97
106
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, PasteContents, PasteTypes } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
3
|
-
import { PastePluginActionTypes as ActionTypes } from '
|
|
4
|
-
import { createCommand } from '
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { PastePluginActionTypes as ActionTypes } from '../editor-actions/actions';
|
|
4
|
+
import { createCommand } from '../pm-plugins/plugin-factory';
|
|
5
|
+
import { formatMarkdown, formatPlainText, formatRichText } from '../pm-plugins/util/format-handlers';
|
|
6
|
+
import { pasteOptionsPluginKey, ToolbarDropdownOption } from '../types/types';
|
|
7
7
|
export var showToolbar = function showToolbar(lastContentPasted, selectedOption) {
|
|
8
8
|
var commandAction = function commandAction(editorState) {
|
|
9
9
|
return {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
-
import { hideToolbar, showToolbar } from './commands';
|
|
3
|
+
import { hideToolbar, showToolbar } from './editor-commands/commands';
|
|
4
4
|
import { createPlugin } from './pm-plugins/main';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { pasteOptionsPluginKey, ToolbarDropdownOption } from './types/types';
|
|
6
|
+
import { buildToolbar, isToolbarVisible } from './ui/toolbar';
|
|
7
7
|
export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref) {
|
|
8
8
|
var _api$analytics;
|
|
9
9
|
var config = _ref.config,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import { checkAndHideToolbar } from '../commands';
|
|
5
|
-
import { pasteOptionsPluginKey, ToolbarDropdownOption } from '../types';
|
|
4
|
+
import { checkAndHideToolbar } from '../editor-commands/commands';
|
|
5
|
+
import { pasteOptionsPluginKey, ToolbarDropdownOption } from '../types/types';
|
|
6
6
|
import { PASTE_HIGHLIGHT_DECORATION_KEY, TEXT_HIGHLIGHT_CLASS } from './constants';
|
|
7
7
|
import { createPluginState } from './plugin-factory';
|
|
8
8
|
export function createPlugin(dispatch) {
|
|
@@ -2,10 +2,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import { PastePluginActionTypes } from '../actions';
|
|
6
|
-
import {
|
|
7
|
-
import { pasteOptionsPluginKey } from '../types';
|
|
5
|
+
import { PastePluginActionTypes } from '../editor-actions/actions';
|
|
6
|
+
import { pasteOptionsPluginKey } from '../types/types';
|
|
8
7
|
import { PASTE_OPTIONS_META_ID } from './constants';
|
|
8
|
+
import { reducer } from './reducer';
|
|
9
9
|
var _pluginFactory = pluginFactory(pasteOptionsPluginKey, reducer, {
|
|
10
10
|
mapping: function mapping(tr, pluginState) {
|
|
11
11
|
if (!tr.docChanged || !pluginState.showToolbar) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import { PastePluginActionTypes as ActionTypes } from '
|
|
4
|
+
import { PastePluginActionTypes as ActionTypes } from '../editor-actions/actions';
|
|
5
5
|
export var reducer = function reducer(state, action) {
|
|
6
6
|
switch (action.type) {
|
|
7
7
|
case ActionTypes.SHOW_PASTE_OPTIONS:
|
|
@@ -143,9 +143,14 @@ export function getMarkdownSlice(text, schema, selection) {
|
|
|
143
143
|
try {
|
|
144
144
|
var _doc$content$firstChi, _doc$content$lastChil;
|
|
145
145
|
var textInput = text;
|
|
146
|
+
|
|
147
|
+
// Ignored via go/ees005
|
|
148
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
146
149
|
var textSplitByCodeBlock = textInput.split(/```/);
|
|
147
150
|
for (var i = 0; i < textSplitByCodeBlock.length; i++) {
|
|
148
151
|
if (i % 2 === 0) {
|
|
152
|
+
// Ignored via go/ees005
|
|
153
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
149
154
|
textSplitByCodeBlock[i] = textSplitByCodeBlock[i].replace(/\\/g, '\\\\');
|
|
150
155
|
}
|
|
151
156
|
}
|
|
@@ -5,7 +5,11 @@ export function isPastedFromFabricEditor(pastedFrom) {
|
|
|
5
5
|
// @see https://product-fabric.atlassian.net/browse/ED-3159
|
|
6
6
|
// @see https://github.com/markdown-it/markdown-it/issues/38
|
|
7
7
|
export function escapeLinks(text) {
|
|
8
|
+
// Ignored via go/ees005
|
|
9
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
8
10
|
return text.replace(/(\[([^\]]+)\]\()?((https?|ftp|jamfselfservice):\/\/[^\s"'>]+)/g, function (str) {
|
|
11
|
+
// Ignored via go/ees005
|
|
12
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
9
13
|
return str.match(/^(https?|ftp|jamfselfservice):\/\/[^\s"'>]+$/) ? "<".concat(str, ">") : str;
|
|
10
14
|
});
|
|
11
15
|
}
|
|
@@ -10,6 +10,8 @@ var CustomGlyph = function CustomGlyph(props) {
|
|
|
10
10
|
viewBox: "0 0 24 24",
|
|
11
11
|
fill: "none",
|
|
12
12
|
xmlns: "http://www.w3.org/2000/svg"
|
|
13
|
+
// Ignored via go/ees005
|
|
14
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
13
15
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
14
16
|
fillRule: "evenodd",
|
|
15
17
|
clipRule: "evenodd",
|
|
@@ -31,6 +33,9 @@ var CustomGlyph = function CustomGlyph(props) {
|
|
|
31
33
|
fill: "currentColor"
|
|
32
34
|
}));
|
|
33
35
|
};
|
|
36
|
+
|
|
37
|
+
// Ignored via go/ees005
|
|
38
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
34
39
|
var EditorPasteIcon = function EditorPasteIcon(props) {
|
|
35
40
|
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
36
41
|
glyph: CustomGlyph
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { pasteOptionsToolbarMessages as messages } from '@atlaskit/editor-common/messages';
|
|
2
2
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
3
|
-
import { changeToMarkdownWithAnalytics, changeToPlainTextWithAnalytics, changeToRichTextWithAnalytics, dropdownClickHandler } from '
|
|
4
|
-
import { PASTE_OPTIONS_TEST_ID, PASTE_TOOLBAR_CLASS, PASTE_TOOLBAR_ITEM_CLASS } from '
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
3
|
+
import { changeToMarkdownWithAnalytics, changeToPlainTextWithAnalytics, changeToRichTextWithAnalytics, dropdownClickHandler } from '../editor-commands/commands';
|
|
4
|
+
import { PASTE_OPTIONS_TEST_ID, PASTE_TOOLBAR_CLASS, PASTE_TOOLBAR_ITEM_CLASS } from '../pm-plugins/constants';
|
|
5
|
+
import { hasLinkMark, hasMediaNode, hasRuleNode, isPastedFromFabricEditor } from '../pm-plugins/util';
|
|
6
|
+
import { pasteOptionsPluginKey, ToolbarDropdownOption } from '../types/types';
|
|
7
|
+
import EditorPasteIcon from './paste-icon';
|
|
8
8
|
export var isToolbarVisible = function isToolbarVisible(state, lastContentPasted) {
|
|
9
9
|
var _$from$parent, _$from$node, _state$schema$nodes$c;
|
|
10
10
|
/**
|
|
@@ -74,6 +74,9 @@ export var buildToolbar = function buildToolbar(state, intl, editorAnalyticsAPI)
|
|
|
74
74
|
var onPositionCalculated = function onPositionCalculated(editorView, nextPos) {
|
|
75
75
|
var from = editorView.state.selection.from;
|
|
76
76
|
var fromCoords = editorView.coordsAtPos(from);
|
|
77
|
+
|
|
78
|
+
// Ignored via go/ees005
|
|
79
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
77
80
|
var toolbar = document.querySelector("div[aria-label=\"".concat(messages.pasteOptions.defaultMessage, "\"]"));
|
|
78
81
|
var offsetParent = (toolbar === null || toolbar === void 0 ? void 0 : toolbar.offsetParent) || editorView.dom;
|
|
79
82
|
var offsetParentRect = offsetParent === null || offsetParent === void 0 ? void 0 : offsetParent.getBoundingClientRect();
|
|
@@ -88,6 +91,12 @@ var onPositionCalculated = function onPositionCalculated(editorView, nextPos) {
|
|
|
88
91
|
};
|
|
89
92
|
var getCursorHeight = function getCursorHeight(editorView, from) {
|
|
90
93
|
var nodeAtFrom = editorView.domAtPos(from).node;
|
|
91
|
-
var nearestNonTextNode = (nodeAtFrom === null || nodeAtFrom === void 0 ? void 0 : nodeAtFrom.nodeType) === Node.TEXT_NODE ?
|
|
94
|
+
var nearestNonTextNode = (nodeAtFrom === null || nodeAtFrom === void 0 ? void 0 : nodeAtFrom.nodeType) === Node.TEXT_NODE ?
|
|
95
|
+
// Ignored via go/ees005
|
|
96
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
97
|
+
nodeAtFrom.parentNode :
|
|
98
|
+
// Ignored via go/ees005
|
|
99
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
100
|
+
nodeAtFrom;
|
|
92
101
|
return parseFloat(window.getComputedStyle(nearestNonTextNode, undefined).lineHeight || '');
|
|
93
102
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { ToolbarDropdownOption } from '
|
|
2
|
+
import type { ToolbarDropdownOption } from '../types/types';
|
|
3
3
|
export declare enum PastePluginActionTypes {
|
|
4
4
|
START_TRACKING_PASTED_MACRO_POSITIONS = "START_TRACKING_PASTED_MACRO_POSITIONS",
|
|
5
5
|
STOP_TRACKING_PASTED_MACRO_POSITIONS = "STOP_TRACKING_PASTED_MACRO_POSITIONS",
|
|
@@ -2,7 +2,7 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { LastContentPasted } from '@atlaskit/editor-plugin-paste';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import { ToolbarDropdownOption } from '
|
|
5
|
+
import { ToolbarDropdownOption } from '../types/types';
|
|
6
6
|
export declare const showToolbar: (lastContentPasted: LastContentPasted, selectedOption: ToolbarDropdownOption) => Command;
|
|
7
7
|
export declare const changeToPlainText: () => Command;
|
|
8
8
|
export declare const changeToPlainTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, sliceSize: number) => () => Command;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { pasteOptionsToolbarPlugin } from './
|
|
2
|
-
export type { PasteOptionsToolbarPlugin } from './
|
|
1
|
+
export { pasteOptionsToolbarPlugin } from './pasteOptionsToolbarPlugin';
|
|
2
|
+
export type { PasteOptionsToolbarPlugin } from './pasteOptionsToolbarPluginType';
|
|
@@ -4,4 +4,3 @@ import type { PastePlugin } from '@atlaskit/editor-plugin-paste';
|
|
|
4
4
|
export type PasteOptionsToolbarPlugin = NextEditorPlugin<'pasteOptionsToolbarPlugin', {
|
|
5
5
|
dependencies: [OptionalPlugin<AnalyticsPlugin>, PastePlugin];
|
|
6
6
|
}>;
|
|
7
|
-
export declare const pasteOptionsToolbarPlugin: PasteOptionsToolbarPlugin;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
export declare function createPlugin(dispatch: Dispatch): SafePlugin<import("../types").PasteOtionsPluginState>;
|
|
3
|
+
export declare function createPlugin(dispatch: Dispatch): SafePlugin<import("../types/types").PasteOtionsPluginState>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PasteOtionsPluginState } from '../types';
|
|
2
|
-
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: PasteOtionsPluginState | ((state: import("prosemirror-state").EditorState) => PasteOtionsPluginState)) => import("prosemirror-state").SafeStateField<PasteOtionsPluginState>, createCommand: <A = import("../actions").PastePluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => PasteOtionsPluginState;
|
|
1
|
+
import type { PasteOtionsPluginState } from '../types/types';
|
|
2
|
+
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: PasteOtionsPluginState | ((state: import("prosemirror-state").EditorState) => PasteOtionsPluginState)) => import("prosemirror-state").SafeStateField<PasteOtionsPluginState>, createCommand: <A = import("../editor-actions/actions").PastePluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => PasteOtionsPluginState;
|
|
@@ -2,7 +2,7 @@ import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
|
2
2
|
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import type { PasteOtionsPluginState } from '
|
|
5
|
+
import type { PasteOtionsPluginState } from '../../types/types';
|
|
6
6
|
export declare const formatMarkdown: (tr: Transaction, pluginState: PasteOtionsPluginState) => Transaction;
|
|
7
7
|
export declare const formatRichText: (tr: Transaction, pluginState: PasteOtionsPluginState) => Transaction;
|
|
8
8
|
export declare const formatPlainText: (tr: Transaction, pluginState: PasteOtionsPluginState) => Transaction;
|
|
@@ -3,7 +3,7 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import type { Command, FloatingToolbarConfig, FloatingToolbarDropdown } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { LastContentPasted } from '@atlaskit/editor-plugin-paste';
|
|
5
5
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
-
import type { PasteOtionsPluginState } from '
|
|
6
|
+
import type { PasteOtionsPluginState } from '../types/types';
|
|
7
7
|
export declare const isToolbarVisible: (state: EditorState, lastContentPasted: LastContentPasted) => boolean;
|
|
8
8
|
export declare const getToolbarMenuConfig: (pluginState: PasteOtionsPluginState, intl: IntlShape, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => FloatingToolbarDropdown<Command>;
|
|
9
9
|
export declare const buildToolbar: (state: EditorState, intl: IntlShape, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => FloatingToolbarConfig | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { ToolbarDropdownOption } from '
|
|
2
|
+
import type { ToolbarDropdownOption } from '../types/types';
|
|
3
3
|
export declare enum PastePluginActionTypes {
|
|
4
4
|
START_TRACKING_PASTED_MACRO_POSITIONS = "START_TRACKING_PASTED_MACRO_POSITIONS",
|
|
5
5
|
STOP_TRACKING_PASTED_MACRO_POSITIONS = "STOP_TRACKING_PASTED_MACRO_POSITIONS",
|
|
@@ -2,7 +2,7 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { LastContentPasted } from '@atlaskit/editor-plugin-paste';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import { ToolbarDropdownOption } from '
|
|
5
|
+
import { ToolbarDropdownOption } from '../types/types';
|
|
6
6
|
export declare const showToolbar: (lastContentPasted: LastContentPasted, selectedOption: ToolbarDropdownOption) => Command;
|
|
7
7
|
export declare const changeToPlainText: () => Command;
|
|
8
8
|
export declare const changeToPlainTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, sliceSize: number) => () => Command;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { pasteOptionsToolbarPlugin } from './
|
|
2
|
-
export type { PasteOptionsToolbarPlugin } from './
|
|
1
|
+
export { pasteOptionsToolbarPlugin } from './pasteOptionsToolbarPlugin';
|
|
2
|
+
export type { PasteOptionsToolbarPlugin } from './pasteOptionsToolbarPluginType';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
export declare function createPlugin(dispatch: Dispatch): SafePlugin<import("../types").PasteOtionsPluginState>;
|
|
3
|
+
export declare function createPlugin(dispatch: Dispatch): SafePlugin<import("../types/types").PasteOtionsPluginState>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PasteOtionsPluginState } from '../types';
|
|
2
|
-
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: PasteOtionsPluginState | ((state: import("prosemirror-state").EditorState) => PasteOtionsPluginState)) => import("prosemirror-state").SafeStateField<PasteOtionsPluginState>, createCommand: <A = import("../actions").PastePluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => PasteOtionsPluginState;
|
|
1
|
+
import type { PasteOtionsPluginState } from '../types/types';
|
|
2
|
+
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: PasteOtionsPluginState | ((state: import("prosemirror-state").EditorState) => PasteOtionsPluginState)) => import("prosemirror-state").SafeStateField<PasteOtionsPluginState>, createCommand: <A = import("../editor-actions/actions").PastePluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => PasteOtionsPluginState;
|
|
@@ -2,7 +2,7 @@ import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
|
2
2
|
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import type { PasteOtionsPluginState } from '
|
|
5
|
+
import type { PasteOtionsPluginState } from '../../types/types';
|
|
6
6
|
export declare const formatMarkdown: (tr: Transaction, pluginState: PasteOtionsPluginState) => Transaction;
|
|
7
7
|
export declare const formatRichText: (tr: Transaction, pluginState: PasteOtionsPluginState) => Transaction;
|
|
8
8
|
export declare const formatPlainText: (tr: Transaction, pluginState: PasteOtionsPluginState) => Transaction;
|
|
@@ -3,7 +3,7 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import type { Command, FloatingToolbarConfig, FloatingToolbarDropdown } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { LastContentPasted } from '@atlaskit/editor-plugin-paste';
|
|
5
5
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
-
import type { PasteOtionsPluginState } from '
|
|
6
|
+
import type { PasteOtionsPluginState } from '../types/types';
|
|
7
7
|
export declare const isToolbarVisible: (state: EditorState, lastContentPasted: LastContentPasted) => boolean;
|
|
8
8
|
export declare const getToolbarMenuConfig: (pluginState: PasteOtionsPluginState, intl: IntlShape, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => FloatingToolbarDropdown<Command>;
|
|
9
9
|
export declare const buildToolbar: (state: EditorState, intl: IntlShape, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => FloatingToolbarConfig | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste-options-toolbar",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"description": "Paste options toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"af:exports": {
|
|
31
31
|
".": "./src/index.ts",
|
|
32
|
-
"./styles": "./src/styles.ts"
|
|
32
|
+
"./styles": "./src/ui/styles.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/editor-common": "^
|
|
35
|
+
"@atlaskit/editor-common": "^97.2.0",
|
|
36
36
|
"@atlaskit/editor-markdown-transformer": "^5.13.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
38
38
|
"@atlaskit/editor-plugin-paste": "^2.0.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
41
|
-
"@atlaskit/icon": "^23.
|
|
42
|
-
"@atlaskit/tokens": "^2.
|
|
41
|
+
"@atlaskit/icon": "^23.1.0",
|
|
42
|
+
"@atlaskit/tokens": "^2.5.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"@emotion/react": "^11.7.1",
|
|
45
45
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"techstack": {
|
|
60
60
|
"@atlassian/frontend": {
|
|
61
61
|
"code-structure": [
|
|
62
|
-
"
|
|
62
|
+
"editor-plugin"
|
|
63
63
|
],
|
|
64
64
|
"import-structure": [
|
|
65
65
|
"atlassian-conventions"
|
package/styles/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste-options-toolbar/styles",
|
|
3
|
-
"main": "../dist/cjs/styles.js",
|
|
4
|
-
"module": "../dist/esm/styles.js",
|
|
5
|
-
"module:es2019": "../dist/es2019/styles.js",
|
|
3
|
+
"main": "../dist/cjs/ui/styles.js",
|
|
4
|
+
"module": "../dist/esm/ui/styles.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/ui/styles.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/styles.d.ts",
|
|
7
|
+
"types": "../dist/types/ui/styles.d.ts",
|
|
8
8
|
"typesVersions": {
|
|
9
9
|
">=4.5 <5.4": {
|
|
10
10
|
"*": [
|
|
11
|
-
"../dist/types-ts4.5/styles.d.ts"
|
|
11
|
+
"../dist/types-ts4.5/ui/styles.d.ts"
|
|
12
12
|
]
|
|
13
13
|
}
|
|
14
14
|
}
|
package/dist/cjs/styles.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "textHighlightStyle", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _styles.textHighlightStyle;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _styles = require("./ui/styles");
|
package/dist/es2019/styles.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { textHighlightStyle } from './ui/styles';
|
package/dist/esm/styles.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { textHighlightStyle } from './ui/styles';
|
package/dist/types/reducer.d.ts
DELETED
package/dist/types/styles.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { textHighlightStyle } from './ui/styles';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { textHighlightStyle } from './ui/styles';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|