@atlaskit/editor-plugin-base 2.1.0 → 2.1.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 +6 -0
- package/dist/cjs/basePlugin.js +6 -18
- package/dist/cjs/pm-plugins/frozen-editor.js +1 -4
- package/dist/cjs/pm-plugins/scroll-gutter/plugin.js +22 -239
- package/dist/es2019/basePlugin.js +4 -15
- package/dist/es2019/pm-plugins/frozen-editor.js +1 -4
- package/dist/es2019/pm-plugins/scroll-gutter/plugin.js +19 -224
- package/dist/esm/basePlugin.js +6 -19
- package/dist/esm/pm-plugins/frozen-editor.js +1 -4
- package/dist/esm/pm-plugins/scroll-gutter/plugin.js +21 -238
- package/dist/types/pm-plugins/scroll-gutter/plugin.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/scroll-gutter/plugin.d.ts +4 -0
- package/package.json +4 -9
- package/tsconfig.app.json +0 -3
- package/dist/cjs/pm-plugins/scroll-gutter/plugin-next.js +0 -75
- package/dist/es2019/pm-plugins/scroll-gutter/plugin-next.js +0 -65
- package/dist/esm/pm-plugins/scroll-gutter/plugin-next.js +0 -69
- package/dist/types/pm-plugins/scroll-gutter/plugin-next.d.ts +0 -24
- package/dist/types-ts4.5/pm-plugins/scroll-gutter/plugin-next.d.ts +0 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-base",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Base plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
35
|
-
"@atlaskit/editor-common": "^99.
|
|
35
|
+
"@atlaskit/editor-common": "^99.7.0",
|
|
36
36
|
"@atlaskit/editor-plugin-context-identifier": "^1.3.0",
|
|
37
37
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
39
|
-
"@atlaskit/platform-feature-flags": "^0.
|
|
40
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
39
|
+
"@atlaskit/platform-feature-flags": "^1.0.0",
|
|
40
|
+
"@atlaskit/tmp-editor-statsig": "^2.41.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0"
|
|
42
42
|
},
|
|
43
43
|
"techstack": {
|
|
@@ -77,10 +77,5 @@
|
|
|
77
77
|
"no-unused-dependencies": {
|
|
78
78
|
"checkDevDependencies": true
|
|
79
79
|
}
|
|
80
|
-
},
|
|
81
|
-
"platform-feature-flags": {
|
|
82
|
-
"platform_editor_improved_scroll_gutter": {
|
|
83
|
-
"type": "boolean"
|
|
84
|
-
}
|
|
85
80
|
}
|
|
86
81
|
}
|
package/tsconfig.app.json
CHANGED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
-
var _pluginKey = require("./plugin-key");
|
|
9
|
-
var GUTTER_SIZE_IN_PX = 120;
|
|
10
|
-
var GUTTER_SELECTOR_NAME = 'editor-scroll-gutter';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Create a gutter element that can be added or removed from the DOM.
|
|
14
|
-
*/
|
|
15
|
-
function createGutter(gutterSize, parent) {
|
|
16
|
-
var gutter = document.createElement('div');
|
|
17
|
-
gutter.style.paddingBottom = "".concat(gutterSize, "px");
|
|
18
|
-
gutter.setAttribute('data-vc', 'scroll-gutter');
|
|
19
|
-
gutter.id = GUTTER_SELECTOR_NAME;
|
|
20
|
-
if (parent) {
|
|
21
|
-
parent.appendChild(gutter);
|
|
22
|
-
}
|
|
23
|
-
return function () {
|
|
24
|
-
return parent === null || parent === void 0 ? void 0 : parent.removeChild(gutter);
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
var _default = exports.default = function _default() {
|
|
28
|
-
var pluginOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
29
|
-
var getScrollElement = pluginOptions.getScrollElement,
|
|
30
|
-
_pluginOptions$gutter = pluginOptions.gutterSize,
|
|
31
|
-
gutterSize = _pluginOptions$gutter === void 0 ? GUTTER_SIZE_IN_PX : _pluginOptions$gutter;
|
|
32
|
-
if (!getScrollElement) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
return new _safePlugin.SafePlugin({
|
|
36
|
-
key: _pluginKey.scrollGutterPluginKey,
|
|
37
|
-
state: {
|
|
38
|
-
init: function init() {
|
|
39
|
-
return {};
|
|
40
|
-
},
|
|
41
|
-
apply: function apply(tr, pluginState) {
|
|
42
|
-
if (tr.getMeta(_pluginKey.scrollGutterPluginKey)) {
|
|
43
|
-
return tr.getMeta(_pluginKey.scrollGutterPluginKey);
|
|
44
|
-
}
|
|
45
|
-
return pluginState;
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
props: {
|
|
49
|
-
// Determines the distance (in pixels) between the cursor and the end of the visible viewport at which point,
|
|
50
|
-
// when scrolling the cursor into view, scrolling takes place.
|
|
51
|
-
// Defaults to 0: https://prosemirror.net/docs/ref/#view.EditorProps.scrollThreshold
|
|
52
|
-
scrollThreshold: gutterSize,
|
|
53
|
-
// Determines the extra space (in pixels) that is left above or below the cursor when it is scrolled into view.
|
|
54
|
-
// Defaults to 5: https://prosemirror.net/docs/ref/#view.EditorProps.scrollMargin
|
|
55
|
-
scrollMargin: gutterSize
|
|
56
|
-
},
|
|
57
|
-
view: function view(_view) {
|
|
58
|
-
var _editorElement;
|
|
59
|
-
// Store references to avoid lookups on successive checks.
|
|
60
|
-
var scrollElement = getScrollElement(_view);
|
|
61
|
-
var editorElement = _view.dom instanceof HTMLElement ? _view.dom : null;
|
|
62
|
-
var editorParentElement = (_editorElement = editorElement) === null || _editorElement === void 0 ? void 0 : _editorElement.parentElement;
|
|
63
|
-
var cleanup = function cleanup() {};
|
|
64
|
-
if (editorParentElement && scrollElement) {
|
|
65
|
-
cleanup = createGutter(gutterSize, editorParentElement);
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
destroy: function destroy() {
|
|
69
|
-
cleanup();
|
|
70
|
-
editorParentElement = editorElement = null;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { scrollGutterPluginKey } from './plugin-key';
|
|
3
|
-
const GUTTER_SIZE_IN_PX = 120;
|
|
4
|
-
const GUTTER_SELECTOR_NAME = 'editor-scroll-gutter';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Create a gutter element that can be added or removed from the DOM.
|
|
8
|
-
*/
|
|
9
|
-
function createGutter(gutterSize, parent) {
|
|
10
|
-
const gutter = document.createElement('div');
|
|
11
|
-
gutter.style.paddingBottom = `${gutterSize}px`;
|
|
12
|
-
gutter.setAttribute('data-vc', 'scroll-gutter');
|
|
13
|
-
gutter.id = GUTTER_SELECTOR_NAME;
|
|
14
|
-
if (parent) {
|
|
15
|
-
parent.appendChild(gutter);
|
|
16
|
-
}
|
|
17
|
-
return () => parent === null || parent === void 0 ? void 0 : parent.removeChild(gutter);
|
|
18
|
-
}
|
|
19
|
-
export default ((pluginOptions = {}) => {
|
|
20
|
-
const {
|
|
21
|
-
getScrollElement,
|
|
22
|
-
gutterSize = GUTTER_SIZE_IN_PX
|
|
23
|
-
} = pluginOptions;
|
|
24
|
-
if (!getScrollElement) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
return new SafePlugin({
|
|
28
|
-
key: scrollGutterPluginKey,
|
|
29
|
-
state: {
|
|
30
|
-
init: () => ({}),
|
|
31
|
-
apply: (tr, pluginState) => {
|
|
32
|
-
if (tr.getMeta(scrollGutterPluginKey)) {
|
|
33
|
-
return tr.getMeta(scrollGutterPluginKey);
|
|
34
|
-
}
|
|
35
|
-
return pluginState;
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
props: {
|
|
39
|
-
// Determines the distance (in pixels) between the cursor and the end of the visible viewport at which point,
|
|
40
|
-
// when scrolling the cursor into view, scrolling takes place.
|
|
41
|
-
// Defaults to 0: https://prosemirror.net/docs/ref/#view.EditorProps.scrollThreshold
|
|
42
|
-
scrollThreshold: gutterSize,
|
|
43
|
-
// Determines the extra space (in pixels) that is left above or below the cursor when it is scrolled into view.
|
|
44
|
-
// Defaults to 5: https://prosemirror.net/docs/ref/#view.EditorProps.scrollMargin
|
|
45
|
-
scrollMargin: gutterSize
|
|
46
|
-
},
|
|
47
|
-
view(view) {
|
|
48
|
-
var _editorElement;
|
|
49
|
-
// Store references to avoid lookups on successive checks.
|
|
50
|
-
const scrollElement = getScrollElement(view);
|
|
51
|
-
let editorElement = view.dom instanceof HTMLElement ? view.dom : null;
|
|
52
|
-
let editorParentElement = (_editorElement = editorElement) === null || _editorElement === void 0 ? void 0 : _editorElement.parentElement;
|
|
53
|
-
let cleanup = () => {};
|
|
54
|
-
if (editorParentElement && scrollElement) {
|
|
55
|
-
cleanup = createGutter(gutterSize, editorParentElement);
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
destroy() {
|
|
59
|
-
cleanup();
|
|
60
|
-
editorParentElement = editorElement = null;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { scrollGutterPluginKey } from './plugin-key';
|
|
3
|
-
var GUTTER_SIZE_IN_PX = 120;
|
|
4
|
-
var GUTTER_SELECTOR_NAME = 'editor-scroll-gutter';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Create a gutter element that can be added or removed from the DOM.
|
|
8
|
-
*/
|
|
9
|
-
function createGutter(gutterSize, parent) {
|
|
10
|
-
var gutter = document.createElement('div');
|
|
11
|
-
gutter.style.paddingBottom = "".concat(gutterSize, "px");
|
|
12
|
-
gutter.setAttribute('data-vc', 'scroll-gutter');
|
|
13
|
-
gutter.id = GUTTER_SELECTOR_NAME;
|
|
14
|
-
if (parent) {
|
|
15
|
-
parent.appendChild(gutter);
|
|
16
|
-
}
|
|
17
|
-
return function () {
|
|
18
|
-
return parent === null || parent === void 0 ? void 0 : parent.removeChild(gutter);
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export default (function () {
|
|
22
|
-
var pluginOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
23
|
-
var getScrollElement = pluginOptions.getScrollElement,
|
|
24
|
-
_pluginOptions$gutter = pluginOptions.gutterSize,
|
|
25
|
-
gutterSize = _pluginOptions$gutter === void 0 ? GUTTER_SIZE_IN_PX : _pluginOptions$gutter;
|
|
26
|
-
if (!getScrollElement) {
|
|
27
|
-
return undefined;
|
|
28
|
-
}
|
|
29
|
-
return new SafePlugin({
|
|
30
|
-
key: scrollGutterPluginKey,
|
|
31
|
-
state: {
|
|
32
|
-
init: function init() {
|
|
33
|
-
return {};
|
|
34
|
-
},
|
|
35
|
-
apply: function apply(tr, pluginState) {
|
|
36
|
-
if (tr.getMeta(scrollGutterPluginKey)) {
|
|
37
|
-
return tr.getMeta(scrollGutterPluginKey);
|
|
38
|
-
}
|
|
39
|
-
return pluginState;
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
props: {
|
|
43
|
-
// Determines the distance (in pixels) between the cursor and the end of the visible viewport at which point,
|
|
44
|
-
// when scrolling the cursor into view, scrolling takes place.
|
|
45
|
-
// Defaults to 0: https://prosemirror.net/docs/ref/#view.EditorProps.scrollThreshold
|
|
46
|
-
scrollThreshold: gutterSize,
|
|
47
|
-
// Determines the extra space (in pixels) that is left above or below the cursor when it is scrolled into view.
|
|
48
|
-
// Defaults to 5: https://prosemirror.net/docs/ref/#view.EditorProps.scrollMargin
|
|
49
|
-
scrollMargin: gutterSize
|
|
50
|
-
},
|
|
51
|
-
view: function view(_view) {
|
|
52
|
-
var _editorElement;
|
|
53
|
-
// Store references to avoid lookups on successive checks.
|
|
54
|
-
var scrollElement = getScrollElement(_view);
|
|
55
|
-
var editorElement = _view.dom instanceof HTMLElement ? _view.dom : null;
|
|
56
|
-
var editorParentElement = (_editorElement = editorElement) === null || _editorElement === void 0 ? void 0 : _editorElement.parentElement;
|
|
57
|
-
var cleanup = function cleanup() {};
|
|
58
|
-
if (editorParentElement && scrollElement) {
|
|
59
|
-
cleanup = createGutter(gutterSize, editorParentElement);
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
destroy: function destroy() {
|
|
63
|
-
cleanup();
|
|
64
|
-
editorParentElement = editorElement = null;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
export type ScrollGutterPluginOptions = {
|
|
4
|
-
/** Element the page uses for scrolling */
|
|
5
|
-
getScrollElement?: (view: EditorView) => HTMLElement | null;
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated
|
|
8
|
-
*
|
|
9
|
-
* Whether to allow custom functionality to scroll to gutter element in
|
|
10
|
-
* plugin's handleScrollToSelection function
|
|
11
|
-
* Default is true
|
|
12
|
-
*/
|
|
13
|
-
allowCustomScrollHandler?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated
|
|
16
|
-
*
|
|
17
|
-
* Persist scroll gutter when the mobile appearance is COMPACT
|
|
18
|
-
* Default is false
|
|
19
|
-
*/
|
|
20
|
-
persistScrollGutter?: boolean;
|
|
21
|
-
gutterSize?: number;
|
|
22
|
-
};
|
|
23
|
-
declare const _default: (pluginOptions?: ScrollGutterPluginOptions) => SafePlugin<{}> | undefined;
|
|
24
|
-
export default _default;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
export type ScrollGutterPluginOptions = {
|
|
4
|
-
/** Element the page uses for scrolling */
|
|
5
|
-
getScrollElement?: (view: EditorView) => HTMLElement | null;
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated
|
|
8
|
-
*
|
|
9
|
-
* Whether to allow custom functionality to scroll to gutter element in
|
|
10
|
-
* plugin's handleScrollToSelection function
|
|
11
|
-
* Default is true
|
|
12
|
-
*/
|
|
13
|
-
allowCustomScrollHandler?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated
|
|
16
|
-
*
|
|
17
|
-
* Persist scroll gutter when the mobile appearance is COMPACT
|
|
18
|
-
* Default is false
|
|
19
|
-
*/
|
|
20
|
-
persistScrollGutter?: boolean;
|
|
21
|
-
gutterSize?: number;
|
|
22
|
-
};
|
|
23
|
-
declare const _default: (pluginOptions?: ScrollGutterPluginOptions) => SafePlugin<{}> | undefined;
|
|
24
|
-
export default _default;
|