@atlaskit/editor-plugin-selection-extension 2.2.4 → 2.2.6
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 +15 -0
- package/dist/cjs/selectionExtensionPlugin.js +4 -1
- package/dist/es2019/selectionExtensionPlugin.js +3 -1
- package/dist/esm/selectionExtensionPlugin.js +4 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/ui/getBoundingBoxFromSelection.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/ui/getBoundingBoxFromSelection.d.ts +1 -1
- package/package.json +12 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection-extension
|
|
2
2
|
|
|
3
|
+
## 2.2.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#157241](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/157241)
|
|
8
|
+
[`bc8b7d4982174`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bc8b7d4982174) -
|
|
9
|
+
When fetching position ensure the matching editor view is used with editor state to avoid position
|
|
10
|
+
mismatches
|
|
11
|
+
|
|
12
|
+
## 2.2.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 2.2.4
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -9,6 +9,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
13
|
var _main = require("./pm-plugins/main");
|
|
13
14
|
var _SelectionExtensionComponentWrapper = require("./ui/extension/SelectionExtensionComponentWrapper");
|
|
14
15
|
var _getBoundingBoxFromSelection = require("./ui/getBoundingBoxFromSelection");
|
|
@@ -105,7 +106,9 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
|
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
108
|
var getSelection = function getSelection(view) {
|
|
108
|
-
|
|
109
|
+
// ensure the same document state is applied to editor view to avoid mismatches
|
|
110
|
+
var _ref5 = (0, _platformFeatureFlags.fg)('platform_editor_extension_toolbar_use_view_state') ? view.state : state,
|
|
111
|
+
currentSelection = _ref5.selection;
|
|
109
112
|
var from = currentSelection.from,
|
|
110
113
|
to = currentSelection.to;
|
|
111
114
|
var text = state.doc.textBetween(from, to, '\n');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { selectionExtensionMessages } from '@atlaskit/editor-common/messages';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { createPlugin, selectionExtensionPluginKey } from './pm-plugins/main';
|
|
5
6
|
import { SelectionExtensionComponentWrapper } from './ui/extension/SelectionExtensionComponentWrapper';
|
|
6
7
|
import { getBoundingBoxFromSelection } from './ui/getBoundingBoxFromSelection';
|
|
@@ -99,9 +100,10 @@ export const selectionExtensionPlugin = ({
|
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
102
|
const getSelection = view => {
|
|
103
|
+
// ensure the same document state is applied to editor view to avoid mismatches
|
|
102
104
|
const {
|
|
103
105
|
selection: currentSelection
|
|
104
|
-
} = state;
|
|
106
|
+
} = fg('platform_editor_extension_toolbar_use_view_state') ? view.state : state;
|
|
105
107
|
const {
|
|
106
108
|
from,
|
|
107
109
|
to
|
|
@@ -2,6 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { selectionExtensionMessages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { createPlugin, selectionExtensionPluginKey } from './pm-plugins/main';
|
|
6
7
|
import { SelectionExtensionComponentWrapper } from './ui/extension/SelectionExtensionComponentWrapper';
|
|
7
8
|
import { getBoundingBoxFromSelection } from './ui/getBoundingBoxFromSelection';
|
|
@@ -98,7 +99,9 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
|
|
|
98
99
|
return;
|
|
99
100
|
}
|
|
100
101
|
var getSelection = function getSelection(view) {
|
|
101
|
-
|
|
102
|
+
// ensure the same document state is applied to editor view to avoid mismatches
|
|
103
|
+
var _ref5 = fg('platform_editor_extension_toolbar_use_view_state') ? view.state : state,
|
|
104
|
+
currentSelection = _ref5.selection;
|
|
102
105
|
var from = currentSelection.from,
|
|
103
106
|
to = currentSelection.to;
|
|
104
107
|
var text = state.doc.textBetween(from, to, '\n');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { SelectionExtensionPluginState } from '../types';
|
|
3
|
+
import { type SelectionExtensionPluginState } from '../types';
|
|
4
4
|
export declare const selectionExtensionPluginKey: PluginKey<SelectionExtensionPluginState>;
|
|
5
5
|
export declare const createPlugin: () => SafePlugin<SelectionExtensionPluginState | {
|
|
6
6
|
activeExtension: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import { SelectionExtensionCoords } from '../types';
|
|
2
|
+
import type { SelectionExtensionCoords } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Calculates the bounding box coordinates of a text selection within an editor view.
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { SelectionExtensionPluginState } from '../types';
|
|
3
|
+
import { type SelectionExtensionPluginState } from '../types';
|
|
4
4
|
export declare const selectionExtensionPluginKey: PluginKey<SelectionExtensionPluginState>;
|
|
5
5
|
export declare const createPlugin: () => SafePlugin<SelectionExtensionPluginState | {
|
|
6
6
|
activeExtension: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import { SelectionExtensionCoords } from '../types';
|
|
2
|
+
import type { SelectionExtensionCoords } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Calculates the bounding box coordinates of a text selection within an editor view.
|
|
5
5
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-extension",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.6",
|
|
4
4
|
"description": "editor-plugin-selection-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,14 +36,15 @@
|
|
|
36
36
|
".": "./src/index.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@atlaskit/editor-common": "^
|
|
40
|
-
"@atlaskit/editor-plugin-analytics": "^2.
|
|
39
|
+
"@atlaskit/editor-common": "^105.6.0",
|
|
40
|
+
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
41
41
|
"@atlaskit/editor-plugin-editor-viewmode": "^3.1.0",
|
|
42
42
|
"@atlaskit/editor-plugin-selection-toolbar": "^3.6.0",
|
|
43
43
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
44
|
-
"@atlaskit/icon": "^26.
|
|
45
|
-
"@atlaskit/
|
|
46
|
-
"@atlaskit/
|
|
44
|
+
"@atlaskit/icon": "^26.1.0",
|
|
45
|
+
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
46
|
+
"@atlaskit/primitives": "^14.8.0",
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^4.22.0",
|
|
47
48
|
"@babel/runtime": "^7.0.0",
|
|
48
49
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
49
50
|
"uuid": "^3.1.0"
|
|
@@ -98,5 +99,10 @@
|
|
|
98
99
|
"import-no-extraneous-disable-for-examples-and-docs"
|
|
99
100
|
]
|
|
100
101
|
}
|
|
102
|
+
},
|
|
103
|
+
"platform-feature-flags": {
|
|
104
|
+
"platform_editor_extension_toolbar_use_view_state": {
|
|
105
|
+
"type": "boolean"
|
|
106
|
+
}
|
|
101
107
|
}
|
|
102
108
|
}
|