@atlaskit/editor-plugin-base 0.2.13 → 0.3.1
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 +12 -0
- package/dist/cjs/plugin.js +4 -14
- package/dist/es2019/plugin.js +3 -11
- package/dist/esm/plugin.js +3 -13
- package/dist/types/plugin.d.ts +0 -1
- package/dist/types-ts4.5/plugin.d.ts +0 -1
- package/package.json +6 -11
- package/tsconfig.app.json +0 -3
- package/dist/cjs/pm-plugins/fix-chrome-88-selection.js +0 -32
- package/dist/es2019/pm-plugins/fix-chrome-88-selection.js +0 -24
- package/dist/esm/pm-plugins/fix-chrome-88-selection.js +0 -26
- package/dist/types/pm-plugins/fix-chrome-88-selection.d.ts +0 -5
- package/dist/types-ts4.5/pm-plugins/fix-chrome-88-selection.d.ts +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-base
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#64064](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/64064) [`77394053290a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/77394053290a) - Comment change to trigger builds
|
|
8
|
+
|
|
9
|
+
## 0.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#63522](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63522) [`906d43c5bb6d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/906d43c5bb6d) - Remove hack for chrome 88 selection bug
|
|
14
|
+
|
|
3
15
|
## 0.2.13
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -5,19 +5,16 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
11
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
12
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
12
|
var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
14
13
|
var _history = require("@atlaskit/editor-prosemirror/history");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
14
|
var _commands2 = require("./commands");
|
|
17
15
|
var _contextIdentifier = _interopRequireWildcard(require("./pm-plugins/context-identifier"));
|
|
18
16
|
var _disableSpellChecking = _interopRequireDefault(require("./pm-plugins/disable-spell-checking"));
|
|
19
17
|
var _filterSteps = _interopRequireDefault(require("./pm-plugins/filter-steps"));
|
|
20
|
-
var _fixChrome88Selection = _interopRequireDefault(require("./pm-plugins/fix-chrome-88-selection"));
|
|
21
18
|
var _frozenEditor = _interopRequireDefault(require("./pm-plugins/frozen-editor"));
|
|
22
19
|
var _inlineCursorTarget = _interopRequireDefault(require("./pm-plugins/inline-cursor-target"));
|
|
23
20
|
var _newlinePreserveMarks = _interopRequireDefault(require("./pm-plugins/newline-preserve-marks"));
|
|
@@ -26,8 +23,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
26
23
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
24
|
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; }
|
|
28
25
|
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; }
|
|
29
|
-
// Chrome >= 88
|
|
30
|
-
var isChromeWithSelectionBug = exports.isChromeWithSelectionBug = _utils.browser.chrome && _utils.browser.chrome_version >= 88;
|
|
31
26
|
var basePlugin = function basePlugin(_ref) {
|
|
32
27
|
var _api$featureFlags;
|
|
33
28
|
var options = _ref.config,
|
|
@@ -55,10 +50,13 @@ var basePlugin = function basePlugin(_ref) {
|
|
|
55
50
|
|
|
56
51
|
// In Chrome, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
57
52
|
// the cursor appears at the right most point of the parent container.
|
|
53
|
+
//
|
|
58
54
|
// In Firefox, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
59
55
|
// no cursor is presented to users.
|
|
56
|
+
//
|
|
60
57
|
// In Safari, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
61
58
|
// it is not possible to navigate with arrow keys.
|
|
59
|
+
//
|
|
62
60
|
// This plugin works around the issues by inserting decorations between
|
|
63
61
|
// inline nodes which are set as contenteditable, and have a zero width space.
|
|
64
62
|
plugins.push({
|
|
@@ -112,14 +110,6 @@ var basePlugin = function basePlugin(_ref) {
|
|
|
112
110
|
}
|
|
113
111
|
});
|
|
114
112
|
}
|
|
115
|
-
if (isChromeWithSelectionBug && !(0, _platformFeatureFlags.getBooleanFF)('platform.editor.disable-chrome-88-selection-fix_uk53m')) {
|
|
116
|
-
plugins.push({
|
|
117
|
-
name: 'fixChrome88SelectionPlugin',
|
|
118
|
-
plugin: function plugin() {
|
|
119
|
-
return (0, _fixChrome88Selection.default)();
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
113
|
plugins.push({
|
|
124
114
|
name: 'disableSpellcheckingPlugin',
|
|
125
115
|
plugin: function plugin() {
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import { doc, paragraph, text } from '@atlaskit/adf-schema';
|
|
2
2
|
import { keymap } from '@atlaskit/editor-common/keymaps';
|
|
3
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
4
3
|
import { baseKeymap } from '@atlaskit/editor-prosemirror/commands';
|
|
5
4
|
import { history } from '@atlaskit/editor-prosemirror/history';
|
|
6
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
5
|
import { setKeyboardHeight } from './commands';
|
|
8
6
|
import contextIdentifierPlugin, { getContextIdentifier } from './pm-plugins/context-identifier';
|
|
9
7
|
import disableSpellcheckingPlugin from './pm-plugins/disable-spell-checking';
|
|
10
8
|
import filterStepsPlugin from './pm-plugins/filter-steps';
|
|
11
|
-
import fixChrome88SelectionPlugin from './pm-plugins/fix-chrome-88-selection';
|
|
12
9
|
import frozenEditor from './pm-plugins/frozen-editor';
|
|
13
10
|
import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
|
|
14
11
|
import newlinePreserveMarksPlugin from './pm-plugins/newline-preserve-marks';
|
|
15
12
|
import scrollGutter, { getKeyboardHeight } from './pm-plugins/scroll-gutter';
|
|
16
|
-
// Chrome >= 88
|
|
17
|
-
export const isChromeWithSelectionBug = browser.chrome && browser.chrome_version >= 88;
|
|
18
13
|
const basePlugin = ({
|
|
19
14
|
config: options,
|
|
20
15
|
api
|
|
@@ -42,10 +37,13 @@ const basePlugin = ({
|
|
|
42
37
|
|
|
43
38
|
// In Chrome, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
44
39
|
// the cursor appears at the right most point of the parent container.
|
|
40
|
+
//
|
|
45
41
|
// In Firefox, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
46
42
|
// no cursor is presented to users.
|
|
43
|
+
//
|
|
47
44
|
// In Safari, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
48
45
|
// it is not possible to navigate with arrow keys.
|
|
46
|
+
//
|
|
49
47
|
// This plugin works around the issues by inserting decorations between
|
|
50
48
|
// inline nodes which are set as contenteditable, and have a zero width space.
|
|
51
49
|
plugins.push({
|
|
@@ -88,12 +86,6 @@ const basePlugin = ({
|
|
|
88
86
|
plugin: () => scrollGutter(options.allowScrollGutter)
|
|
89
87
|
});
|
|
90
88
|
}
|
|
91
|
-
if (isChromeWithSelectionBug && !getBooleanFF('platform.editor.disable-chrome-88-selection-fix_uk53m')) {
|
|
92
|
-
plugins.push({
|
|
93
|
-
name: 'fixChrome88SelectionPlugin',
|
|
94
|
-
plugin: () => fixChrome88SelectionPlugin()
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
89
|
plugins.push({
|
|
98
90
|
name: 'disableSpellcheckingPlugin',
|
|
99
91
|
plugin: () => disableSpellcheckingPlugin(featureFlags)
|
package/dist/esm/plugin.js
CHANGED
|
@@ -3,21 +3,16 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
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 { doc, paragraph, text } from '@atlaskit/adf-schema';
|
|
5
5
|
import { keymap } from '@atlaskit/editor-common/keymaps';
|
|
6
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
7
6
|
import { baseKeymap } from '@atlaskit/editor-prosemirror/commands';
|
|
8
7
|
import { history } from '@atlaskit/editor-prosemirror/history';
|
|
9
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
8
|
import { setKeyboardHeight } from './commands';
|
|
11
9
|
import contextIdentifierPlugin, { getContextIdentifier } from './pm-plugins/context-identifier';
|
|
12
10
|
import disableSpellcheckingPlugin from './pm-plugins/disable-spell-checking';
|
|
13
11
|
import filterStepsPlugin from './pm-plugins/filter-steps';
|
|
14
|
-
import fixChrome88SelectionPlugin from './pm-plugins/fix-chrome-88-selection';
|
|
15
12
|
import frozenEditor from './pm-plugins/frozen-editor';
|
|
16
13
|
import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
|
|
17
14
|
import newlinePreserveMarksPlugin from './pm-plugins/newline-preserve-marks';
|
|
18
15
|
import scrollGutter, { getKeyboardHeight } from './pm-plugins/scroll-gutter';
|
|
19
|
-
// Chrome >= 88
|
|
20
|
-
export var isChromeWithSelectionBug = browser.chrome && browser.chrome_version >= 88;
|
|
21
16
|
var basePlugin = function basePlugin(_ref) {
|
|
22
17
|
var _api$featureFlags;
|
|
23
18
|
var options = _ref.config,
|
|
@@ -45,10 +40,13 @@ var basePlugin = function basePlugin(_ref) {
|
|
|
45
40
|
|
|
46
41
|
// In Chrome, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
47
42
|
// the cursor appears at the right most point of the parent container.
|
|
43
|
+
//
|
|
48
44
|
// In Firefox, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
49
45
|
// no cursor is presented to users.
|
|
46
|
+
//
|
|
50
47
|
// In Safari, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
51
48
|
// it is not possible to navigate with arrow keys.
|
|
49
|
+
//
|
|
52
50
|
// This plugin works around the issues by inserting decorations between
|
|
53
51
|
// inline nodes which are set as contenteditable, and have a zero width space.
|
|
54
52
|
plugins.push({
|
|
@@ -102,14 +100,6 @@ var basePlugin = function basePlugin(_ref) {
|
|
|
102
100
|
}
|
|
103
101
|
});
|
|
104
102
|
}
|
|
105
|
-
if (isChromeWithSelectionBug && !getBooleanFF('platform.editor.disable-chrome-88-selection-fix_uk53m')) {
|
|
106
|
-
plugins.push({
|
|
107
|
-
name: 'fixChrome88SelectionPlugin',
|
|
108
|
-
plugin: function plugin() {
|
|
109
|
-
return fixChrome88SelectionPlugin();
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
103
|
plugins.push({
|
|
114
104
|
name: 'disableSpellcheckingPlugin',
|
|
115
105
|
plugin: function plugin() {
|
package/dist/types/plugin.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Base plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"atlassian": {
|
|
11
11
|
"team": "Editor",
|
|
12
12
|
"singleton": true,
|
|
13
|
-
"releaseModel": "continuous"
|
|
13
|
+
"releaseModel": "continuous",
|
|
14
|
+
"runReact18": false
|
|
14
15
|
},
|
|
15
16
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
16
17
|
"main": "dist/cjs/index.js",
|
|
@@ -32,10 +33,9 @@
|
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"@atlaskit/adf-schema": "^35.2.0",
|
|
35
|
-
"@atlaskit/editor-common": "^76.
|
|
36
|
+
"@atlaskit/editor-common": "^76.30.0",
|
|
36
37
|
"@atlaskit/editor-plugin-feature-flags": "^1.0.1",
|
|
37
38
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
38
|
-
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
39
39
|
"@babel/runtime": "^7.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/editor-plugin-emoji": "^1.0.0",
|
|
45
45
|
"@atlaskit/editor-plugin-guideline": "^0.5.0",
|
|
46
46
|
"@atlaskit/editor-plugin-selection": "^0.1.0",
|
|
47
|
-
"@atlaskit/editor-plugin-table": "^5.
|
|
47
|
+
"@atlaskit/editor-plugin-table": "^5.7.0",
|
|
48
48
|
"@atlaskit/editor-plugin-type-ahead": "^0.8.0",
|
|
49
49
|
"@atlaskit/editor-plugin-width": "^0.2.0",
|
|
50
50
|
"@atlaskit/util-data-test": "^17.8.0",
|
|
@@ -85,10 +85,5 @@
|
|
|
85
85
|
]
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
89
|
-
"platform-feature-flags": {
|
|
90
|
-
"platform.editor.disable-chrome-88-selection-fix_uk53m": {
|
|
91
|
-
"type": "boolean"
|
|
92
|
-
}
|
|
93
|
-
}
|
|
88
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
94
89
|
}
|
package/tsconfig.app.json
CHANGED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.fixChromeSelectionKey = exports.default = void 0;
|
|
7
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
-
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
10
|
-
function isDivHTMLElement(elm) {
|
|
11
|
-
return elm.tagName.toLowerCase() === 'div';
|
|
12
|
-
}
|
|
13
|
-
var fixChromeSelectionKey = exports.fixChromeSelectionKey = new _state.PluginKey('fixChromeSelectionPlugin');
|
|
14
|
-
var _default = exports.default = function _default() {
|
|
15
|
-
return new _safePlugin.SafePlugin({
|
|
16
|
-
key: fixChromeSelectionKey,
|
|
17
|
-
props: {
|
|
18
|
-
handleDOMEvents: {
|
|
19
|
-
focus: function focus(view) {
|
|
20
|
-
// We don't need to reset when there's a NodeSelection
|
|
21
|
-
// It creates other problem. @see HOT-94478
|
|
22
|
-
if (isDivHTMLElement(view.dom) && !(0, _utils.isNodeSelection)(view.state.selection)) {
|
|
23
|
-
view.dom.style.display = 'inline-block';
|
|
24
|
-
view.dom.offsetHeight;
|
|
25
|
-
view.dom.style.display = 'block';
|
|
26
|
-
}
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { isNodeSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
function isDivHTMLElement(elm) {
|
|
5
|
-
return elm.tagName.toLowerCase() === 'div';
|
|
6
|
-
}
|
|
7
|
-
export const fixChromeSelectionKey = new PluginKey('fixChromeSelectionPlugin');
|
|
8
|
-
export default (() => new SafePlugin({
|
|
9
|
-
key: fixChromeSelectionKey,
|
|
10
|
-
props: {
|
|
11
|
-
handleDOMEvents: {
|
|
12
|
-
focus: view => {
|
|
13
|
-
// We don't need to reset when there's a NodeSelection
|
|
14
|
-
// It creates other problem. @see HOT-94478
|
|
15
|
-
if (isDivHTMLElement(view.dom) && !isNodeSelection(view.state.selection)) {
|
|
16
|
-
view.dom.style.display = 'inline-block';
|
|
17
|
-
view.dom.offsetHeight;
|
|
18
|
-
view.dom.style.display = 'block';
|
|
19
|
-
}
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}));
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { isNodeSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
function isDivHTMLElement(elm) {
|
|
5
|
-
return elm.tagName.toLowerCase() === 'div';
|
|
6
|
-
}
|
|
7
|
-
export var fixChromeSelectionKey = new PluginKey('fixChromeSelectionPlugin');
|
|
8
|
-
export default (function () {
|
|
9
|
-
return new SafePlugin({
|
|
10
|
-
key: fixChromeSelectionKey,
|
|
11
|
-
props: {
|
|
12
|
-
handleDOMEvents: {
|
|
13
|
-
focus: function focus(view) {
|
|
14
|
-
// We don't need to reset when there's a NodeSelection
|
|
15
|
-
// It creates other problem. @see HOT-94478
|
|
16
|
-
if (isDivHTMLElement(view.dom) && !isNodeSelection(view.state.selection)) {
|
|
17
|
-
view.dom.style.display = 'inline-block';
|
|
18
|
-
view.dom.offsetHeight;
|
|
19
|
-
view.dom.style.display = 'block';
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
});
|