@atlaskit/editor-plugin-limited-mode 1.0.2 → 2.1.0

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-limited-mode
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`a471e1e42004e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a471e1e42004e) -
8
+ [ux] ED-29329: Remove limited mode banner and replace with a limited mode flag, reusing
9
+ confluence's flag setup.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 2.0.0
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 1.0.2
4
22
 
5
23
  ### Patch Changes
@@ -17,6 +17,9 @@
17
17
  "../src/**/examples.*"
18
18
  ],
19
19
  "references": [
20
+ {
21
+ "path": "../../../design-system/primitives/afm-cc/tsconfig.json"
22
+ },
20
23
  {
21
24
  "path": "../../tmp-editor-statsig/afm-cc/tsconfig.json"
22
25
  },
@@ -17,6 +17,9 @@
17
17
  "../src/**/examples.*"
18
18
  ],
19
19
  "references": [
20
+ {
21
+ "path": "../../../design-system/primitives/afm-dev-agents/tsconfig.json"
22
+ },
20
23
  {
21
24
  "path": "../../tmp-editor-statsig/afm-dev-agents/tsconfig.json"
22
25
  },
@@ -17,6 +17,9 @@
17
17
  "../src/**/examples.*"
18
18
  ],
19
19
  "references": [
20
+ {
21
+ "path": "../../../design-system/primitives/afm-jira/tsconfig.json"
22
+ },
20
23
  {
21
24
  "path": "../../tmp-editor-statsig/afm-jira/tsconfig.json"
22
25
  },
@@ -17,6 +17,9 @@
17
17
  "../src/**/examples.*"
18
18
  ],
19
19
  "references": [
20
+ {
21
+ "path": "../../../design-system/primitives/afm-passionfruit/tsconfig.json"
22
+ },
20
23
  {
21
24
  "path": "../../tmp-editor-statsig/afm-passionfruit/tsconfig.json"
22
25
  },
@@ -17,6 +17,9 @@
17
17
  "../src/**/examples.*"
18
18
  ],
19
19
  "references": [
20
+ {
21
+ "path": "../../../design-system/primitives/afm-post-office/tsconfig.json"
22
+ },
20
23
  {
21
24
  "path": "../../tmp-editor-statsig/afm-post-office/tsconfig.json"
22
25
  },
@@ -17,6 +17,9 @@
17
17
  "../src/**/examples.*"
18
18
  ],
19
19
  "references": [
20
+ {
21
+ "path": "../../../design-system/primitives/afm-rovo-extension/tsconfig.json"
22
+ },
20
23
  {
21
24
  "path": "../../tmp-editor-statsig/afm-rovo-extension/tsconfig.json"
22
25
  },
@@ -17,6 +17,9 @@
17
17
  "../src/**/examples.*"
18
18
  ],
19
19
  "references": [
20
+ {
21
+ "path": "../../../design-system/primitives/afm-townsquare/tsconfig.json"
22
+ },
20
23
  {
21
24
  "path": "../../tmp-editor-statsig/afm-townsquare/tsconfig.json"
22
25
  },
@@ -1,11 +1,24 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.limitedModePlugin = void 0;
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _bindEventListener = require("bind-event-listener");
11
+ var _reactIntlNext = require("react-intl-next");
12
+ var _usePluginStateEffect = require("@atlaskit/editor-common/use-plugin-state-effect");
13
+ var _compiled = require("@atlaskit/primitives/compiled");
14
+ var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
7
15
  var _main = require("./pm-plugins/main");
8
- var limitedModePlugin = exports.limitedModePlugin = function limitedModePlugin() {
16
+ var _messages = _interopRequireDefault(require("./pm-plugins/messages"));
17
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
18
+ var limitedModePlugin = exports.limitedModePlugin = function limitedModePlugin(_ref) {
19
+ var _ref$config = _ref.config,
20
+ options = _ref$config === void 0 ? {} : _ref$config,
21
+ api = _ref.api;
9
22
  return {
10
23
  name: 'limitedMode',
11
24
  pmPlugins: function pmPlugins() {
@@ -28,6 +41,64 @@ var limitedModePlugin = exports.limitedModePlugin = function limitedModePlugin()
28
41
  enabled: false,
29
42
  limitedModePluginKey: _main.limitedModePluginKey
30
43
  };
44
+ },
45
+ usePluginHook: function usePluginHook(_ref2) {
46
+ var editorView = _ref2.editorView;
47
+ var hasEditorBeenFocusedRef = (0, _react.useRef)(false);
48
+ var hasShownFlagRef = (0, _react.useRef)(false);
49
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
50
+ formatMessage = _useIntl.formatMessage;
51
+
52
+ // Reset hasEditorBeenFocusedRef so live-to-live page navigation refreshes the flag. We rely on the page's contentId for this.
53
+ (0, _react.useEffect)(function () {
54
+ hasShownFlagRef.current = false;
55
+ // eslint-disable-next-line react-hooks/exhaustive-deps
56
+ }, [options.contentId]);
57
+ var checkAndShowFlag = (0, _react.useCallback)(function (isLimitedModeEnabled) {
58
+ var _learnMoreLink = (0, _expVal.expVal)('cc_editor_limited_mode', 'learnMoreLink', '');
59
+ if (isLimitedModeEnabled && hasEditorBeenFocusedRef.current && !hasShownFlagRef.current) {
60
+ var _options$showFlag;
61
+ void ((_options$showFlag = options.showFlag) === null || _options$showFlag === void 0 ? void 0 : _options$showFlag.call(options, {
62
+ title: formatMessage(_messages.default.limitedModeTitle),
63
+ description: _learnMoreLink ? formatMessage(_messages.default.limitedModeDescriptionWithLink, {
64
+ learnMoreLink: function learnMoreLink(chunks) {
65
+ return /*#__PURE__*/_react.default.createElement(_compiled.Anchor, {
66
+ target: "_blank",
67
+ href: _learnMoreLink
68
+ }, chunks);
69
+ }
70
+ }) : formatMessage(_messages.default.limitedModeDescriptionWithoutLink),
71
+ close: 'auto'
72
+ }));
73
+ hasShownFlagRef.current = true;
74
+ }
75
+ }, [formatMessage]);
76
+
77
+ // Track if the editor has been focused. On focus, check if the flag should be shown.
78
+ (0, _react.useEffect)(function () {
79
+ var handleFocus = function handleFocus() {
80
+ var _api$limitedMode$shar, _api$limitedMode;
81
+ hasEditorBeenFocusedRef.current = true;
82
+ // Get current state when focus happens
83
+ var isLimitedModeEnabled = (_api$limitedMode$shar = api === null || api === void 0 || (_api$limitedMode = api.limitedMode) === null || _api$limitedMode === void 0 || (_api$limitedMode = _api$limitedMode.sharedState.currentState()) === null || _api$limitedMode === void 0 ? void 0 : _api$limitedMode.enabled) !== null && _api$limitedMode$shar !== void 0 ? _api$limitedMode$shar : false;
84
+ checkAndShowFlag(isLimitedModeEnabled);
85
+ };
86
+ var unbind = (0, _bindEventListener.bind)(editorView.dom, {
87
+ type: 'focus',
88
+ listener: handleFocus
89
+ });
90
+ return function () {
91
+ unbind();
92
+ };
93
+ }, [editorView, checkAndShowFlag]);
94
+
95
+ // On change of the limited mode enabled state, check if the flag should be shown.
96
+ (0, _usePluginStateEffect.usePluginStateEffect)(api, ['limitedMode'], function (_ref3) {
97
+ var _limitedModeState$ena;
98
+ var limitedModeState = _ref3.limitedModeState;
99
+ var isLimitedModeEnabled = (_limitedModeState$ena = limitedModeState === null || limitedModeState === void 0 ? void 0 : limitedModeState.enabled) !== null && _limitedModeState$ena !== void 0 ? _limitedModeState$ena : false;
100
+ checkAndShowFlag(isLimitedModeEnabled);
101
+ });
31
102
  }
32
103
  };
33
104
  };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactIntlNext = require("react-intl-next");
8
+ // Disable no-re-export rule for entry point files
9
+ /* eslint-disable @atlaskit/editor/no-re-export */
10
+ var _default = exports.default = (0, _reactIntlNext.defineMessages)({
11
+ limitedModeTitle: {
12
+ id: 'fabric.editor.limitedModeTitle',
13
+ defaultMessage: 'Speed Improvements',
14
+ description: 'Title for flag shown when some functionality is disabled in a page in order to improve the pages speed.'
15
+ },
16
+ limitedModeDescriptionWithLink: {
17
+ id: 'fabric.editor.limitedModeDescription',
18
+ defaultMessage: 'To increase speed and response time <learnMoreLink>some editing features are limited.</learnMoreLink>',
19
+ description: 'Description for flag shown when some functionality is disabled in a page in order to improve the pages speed. This description contains a link to learn more about limited mode.'
20
+ },
21
+ limitedModeDescriptionWithoutLink: {
22
+ id: 'fabric.editor.limitedModeDescriptionWithoutLink',
23
+ defaultMessage: 'To increase speed and response time some editing features are limited.',
24
+ description: 'Description for flag shown when some functionality is disabled in a page in order to improve the pages speed. This description does not contain a link to learn more about limited mode.'
25
+ }
26
+ });
@@ -1,5 +1,15 @@
1
+ import React, { useRef, useEffect, useCallback } from 'react';
2
+ import { bind } from 'bind-event-listener';
3
+ import { useIntl } from 'react-intl-next';
4
+ import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
5
+ import { Anchor } from '@atlaskit/primitives/compiled';
6
+ import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
1
7
  import { createPlugin, limitedModePluginKey } from './pm-plugins/main';
2
- export const limitedModePlugin = () => {
8
+ import messages from './pm-plugins/messages';
9
+ export const limitedModePlugin = ({
10
+ config: options = {},
11
+ api
12
+ }) => {
3
13
  return {
4
14
  name: 'limitedMode',
5
15
  pmPlugins() {
@@ -22,6 +32,65 @@ export const limitedModePlugin = () => {
22
32
  enabled: false,
23
33
  limitedModePluginKey
24
34
  };
35
+ },
36
+ usePluginHook: ({
37
+ editorView
38
+ }) => {
39
+ const hasEditorBeenFocusedRef = useRef(false);
40
+ const hasShownFlagRef = useRef(false);
41
+ const {
42
+ formatMessage
43
+ } = useIntl();
44
+
45
+ // Reset hasEditorBeenFocusedRef so live-to-live page navigation refreshes the flag. We rely on the page's contentId for this.
46
+ useEffect(() => {
47
+ hasShownFlagRef.current = false;
48
+ // eslint-disable-next-line react-hooks/exhaustive-deps
49
+ }, [options.contentId]);
50
+ const checkAndShowFlag = useCallback(isLimitedModeEnabled => {
51
+ const learnMoreLink = expVal('cc_editor_limited_mode', 'learnMoreLink', '');
52
+ if (isLimitedModeEnabled && hasEditorBeenFocusedRef.current && !hasShownFlagRef.current) {
53
+ var _options$showFlag;
54
+ void ((_options$showFlag = options.showFlag) === null || _options$showFlag === void 0 ? void 0 : _options$showFlag.call(options, {
55
+ title: formatMessage(messages.limitedModeTitle),
56
+ description: learnMoreLink ? formatMessage(messages.limitedModeDescriptionWithLink, {
57
+ learnMoreLink: chunks => /*#__PURE__*/React.createElement(Anchor, {
58
+ target: "_blank",
59
+ href: learnMoreLink
60
+ }, chunks)
61
+ }) : formatMessage(messages.limitedModeDescriptionWithoutLink),
62
+ close: 'auto'
63
+ }));
64
+ hasShownFlagRef.current = true;
65
+ }
66
+ }, [formatMessage]);
67
+
68
+ // Track if the editor has been focused. On focus, check if the flag should be shown.
69
+ useEffect(() => {
70
+ const handleFocus = () => {
71
+ var _api$limitedMode$shar, _api$limitedMode, _api$limitedMode$shar2;
72
+ hasEditorBeenFocusedRef.current = true;
73
+ // Get current state when focus happens
74
+ const isLimitedModeEnabled = (_api$limitedMode$shar = api === null || api === void 0 ? void 0 : (_api$limitedMode = api.limitedMode) === null || _api$limitedMode === void 0 ? void 0 : (_api$limitedMode$shar2 = _api$limitedMode.sharedState.currentState()) === null || _api$limitedMode$shar2 === void 0 ? void 0 : _api$limitedMode$shar2.enabled) !== null && _api$limitedMode$shar !== void 0 ? _api$limitedMode$shar : false;
75
+ checkAndShowFlag(isLimitedModeEnabled);
76
+ };
77
+ const unbind = bind(editorView.dom, {
78
+ type: 'focus',
79
+ listener: handleFocus
80
+ });
81
+ return () => {
82
+ unbind();
83
+ };
84
+ }, [editorView, checkAndShowFlag]);
85
+
86
+ // On change of the limited mode enabled state, check if the flag should be shown.
87
+ usePluginStateEffect(api, ['limitedMode'], ({
88
+ limitedModeState
89
+ }) => {
90
+ var _limitedModeState$ena;
91
+ const isLimitedModeEnabled = (_limitedModeState$ena = limitedModeState === null || limitedModeState === void 0 ? void 0 : limitedModeState.enabled) !== null && _limitedModeState$ena !== void 0 ? _limitedModeState$ena : false;
92
+ checkAndShowFlag(isLimitedModeEnabled);
93
+ });
25
94
  }
26
95
  };
27
96
  };
@@ -0,0 +1,21 @@
1
+ // Disable no-re-export rule for entry point files
2
+ /* eslint-disable @atlaskit/editor/no-re-export */
3
+
4
+ import { defineMessages } from 'react-intl-next';
5
+ export default defineMessages({
6
+ limitedModeTitle: {
7
+ id: 'fabric.editor.limitedModeTitle',
8
+ defaultMessage: 'Speed Improvements',
9
+ description: 'Title for flag shown when some functionality is disabled in a page in order to improve the pages speed.'
10
+ },
11
+ limitedModeDescriptionWithLink: {
12
+ id: 'fabric.editor.limitedModeDescription',
13
+ defaultMessage: 'To increase speed and response time <learnMoreLink>some editing features are limited.</learnMoreLink>',
14
+ description: 'Description for flag shown when some functionality is disabled in a page in order to improve the pages speed. This description contains a link to learn more about limited mode.'
15
+ },
16
+ limitedModeDescriptionWithoutLink: {
17
+ id: 'fabric.editor.limitedModeDescriptionWithoutLink',
18
+ defaultMessage: 'To increase speed and response time some editing features are limited.',
19
+ description: 'Description for flag shown when some functionality is disabled in a page in order to improve the pages speed. This description does not contain a link to learn more about limited mode.'
20
+ }
21
+ });
@@ -1,5 +1,15 @@
1
+ import React, { useRef, useEffect, useCallback } from 'react';
2
+ import { bind } from 'bind-event-listener';
3
+ import { useIntl } from 'react-intl-next';
4
+ import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
5
+ import { Anchor } from '@atlaskit/primitives/compiled';
6
+ import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
1
7
  import { createPlugin, limitedModePluginKey } from './pm-plugins/main';
2
- export var limitedModePlugin = function limitedModePlugin() {
8
+ import messages from './pm-plugins/messages';
9
+ export var limitedModePlugin = function limitedModePlugin(_ref) {
10
+ var _ref$config = _ref.config,
11
+ options = _ref$config === void 0 ? {} : _ref$config,
12
+ api = _ref.api;
3
13
  return {
4
14
  name: 'limitedMode',
5
15
  pmPlugins: function pmPlugins() {
@@ -22,6 +32,64 @@ export var limitedModePlugin = function limitedModePlugin() {
22
32
  enabled: false,
23
33
  limitedModePluginKey: limitedModePluginKey
24
34
  };
35
+ },
36
+ usePluginHook: function usePluginHook(_ref2) {
37
+ var editorView = _ref2.editorView;
38
+ var hasEditorBeenFocusedRef = useRef(false);
39
+ var hasShownFlagRef = useRef(false);
40
+ var _useIntl = useIntl(),
41
+ formatMessage = _useIntl.formatMessage;
42
+
43
+ // Reset hasEditorBeenFocusedRef so live-to-live page navigation refreshes the flag. We rely on the page's contentId for this.
44
+ useEffect(function () {
45
+ hasShownFlagRef.current = false;
46
+ // eslint-disable-next-line react-hooks/exhaustive-deps
47
+ }, [options.contentId]);
48
+ var checkAndShowFlag = useCallback(function (isLimitedModeEnabled) {
49
+ var _learnMoreLink = expVal('cc_editor_limited_mode', 'learnMoreLink', '');
50
+ if (isLimitedModeEnabled && hasEditorBeenFocusedRef.current && !hasShownFlagRef.current) {
51
+ var _options$showFlag;
52
+ void ((_options$showFlag = options.showFlag) === null || _options$showFlag === void 0 ? void 0 : _options$showFlag.call(options, {
53
+ title: formatMessage(messages.limitedModeTitle),
54
+ description: _learnMoreLink ? formatMessage(messages.limitedModeDescriptionWithLink, {
55
+ learnMoreLink: function learnMoreLink(chunks) {
56
+ return /*#__PURE__*/React.createElement(Anchor, {
57
+ target: "_blank",
58
+ href: _learnMoreLink
59
+ }, chunks);
60
+ }
61
+ }) : formatMessage(messages.limitedModeDescriptionWithoutLink),
62
+ close: 'auto'
63
+ }));
64
+ hasShownFlagRef.current = true;
65
+ }
66
+ }, [formatMessage]);
67
+
68
+ // Track if the editor has been focused. On focus, check if the flag should be shown.
69
+ useEffect(function () {
70
+ var handleFocus = function handleFocus() {
71
+ var _api$limitedMode$shar, _api$limitedMode;
72
+ hasEditorBeenFocusedRef.current = true;
73
+ // Get current state when focus happens
74
+ var isLimitedModeEnabled = (_api$limitedMode$shar = api === null || api === void 0 || (_api$limitedMode = api.limitedMode) === null || _api$limitedMode === void 0 || (_api$limitedMode = _api$limitedMode.sharedState.currentState()) === null || _api$limitedMode === void 0 ? void 0 : _api$limitedMode.enabled) !== null && _api$limitedMode$shar !== void 0 ? _api$limitedMode$shar : false;
75
+ checkAndShowFlag(isLimitedModeEnabled);
76
+ };
77
+ var unbind = bind(editorView.dom, {
78
+ type: 'focus',
79
+ listener: handleFocus
80
+ });
81
+ return function () {
82
+ unbind();
83
+ };
84
+ }, [editorView, checkAndShowFlag]);
85
+
86
+ // On change of the limited mode enabled state, check if the flag should be shown.
87
+ usePluginStateEffect(api, ['limitedMode'], function (_ref3) {
88
+ var _limitedModeState$ena;
89
+ var limitedModeState = _ref3.limitedModeState;
90
+ var isLimitedModeEnabled = (_limitedModeState$ena = limitedModeState === null || limitedModeState === void 0 ? void 0 : limitedModeState.enabled) !== null && _limitedModeState$ena !== void 0 ? _limitedModeState$ena : false;
91
+ checkAndShowFlag(isLimitedModeEnabled);
92
+ });
25
93
  }
26
94
  };
27
95
  };
@@ -0,0 +1,21 @@
1
+ // Disable no-re-export rule for entry point files
2
+ /* eslint-disable @atlaskit/editor/no-re-export */
3
+
4
+ import { defineMessages } from 'react-intl-next';
5
+ export default defineMessages({
6
+ limitedModeTitle: {
7
+ id: 'fabric.editor.limitedModeTitle',
8
+ defaultMessage: 'Speed Improvements',
9
+ description: 'Title for flag shown when some functionality is disabled in a page in order to improve the pages speed.'
10
+ },
11
+ limitedModeDescriptionWithLink: {
12
+ id: 'fabric.editor.limitedModeDescription',
13
+ defaultMessage: 'To increase speed and response time <learnMoreLink>some editing features are limited.</learnMoreLink>',
14
+ description: 'Description for flag shown when some functionality is disabled in a page in order to improve the pages speed. This description contains a link to learn more about limited mode.'
15
+ },
16
+ limitedModeDescriptionWithoutLink: {
17
+ id: 'fabric.editor.limitedModeDescriptionWithoutLink',
18
+ defaultMessage: 'To increase speed and response time some editing features are limited.',
19
+ description: 'Description for flag shown when some functionality is disabled in a page in order to improve the pages speed. This description does not contain a link to learn more about limited mode.'
20
+ }
21
+ });
@@ -1,2 +1,2 @@
1
1
  export { limitedModePlugin } from './limitedModePlugin';
2
- export type { LimitedModePlugin, LimitedModePluginState } from './limitedModePluginType';
2
+ export type { LimitedModePlugin, LimitedModePluginState, LimitedModePluginOptions, } from './limitedModePluginType';
@@ -1,11 +1,21 @@
1
+ import type React from 'react';
1
2
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
3
  import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
4
  export type LimitedModePluginState = {
4
5
  documentSizeBreachesThreshold: boolean;
5
6
  };
6
7
  export type LimitedModePlugin = NextEditorPlugin<'limitedMode', {
8
+ pluginConfiguration: LimitedModePluginOptions | undefined;
7
9
  sharedState: {
8
10
  enabled: boolean;
9
11
  limitedModePluginKey: PluginKey<LimitedModePluginState>;
10
12
  };
11
13
  }>;
14
+ export type LimitedModePluginOptions = {
15
+ contentId?: string;
16
+ showFlag?: (props: {
17
+ close: string;
18
+ description: React.ReactNode;
19
+ title: string;
20
+ }) => void;
21
+ };
@@ -0,0 +1,18 @@
1
+ declare const _default: {
2
+ limitedModeTitle: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ limitedModeDescriptionWithLink: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ limitedModeDescriptionWithoutLink: {
13
+ id: string;
14
+ defaultMessage: string;
15
+ description: string;
16
+ };
17
+ };
18
+ export default _default;
@@ -1,2 +1,2 @@
1
1
  export { limitedModePlugin } from './limitedModePlugin';
2
- export type { LimitedModePlugin, LimitedModePluginState } from './limitedModePluginType';
2
+ export type { LimitedModePlugin, LimitedModePluginState, LimitedModePluginOptions, } from './limitedModePluginType';
@@ -1,11 +1,21 @@
1
+ import type React from 'react';
1
2
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
3
  import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
4
  export type LimitedModePluginState = {
4
5
  documentSizeBreachesThreshold: boolean;
5
6
  };
6
7
  export type LimitedModePlugin = NextEditorPlugin<'limitedMode', {
8
+ pluginConfiguration: LimitedModePluginOptions | undefined;
7
9
  sharedState: {
8
10
  enabled: boolean;
9
11
  limitedModePluginKey: PluginKey<LimitedModePluginState>;
10
12
  };
11
13
  }>;
14
+ export type LimitedModePluginOptions = {
15
+ contentId?: string;
16
+ showFlag?: (props: {
17
+ close: string;
18
+ description: React.ReactNode;
19
+ title: string;
20
+ }) => void;
21
+ };
@@ -0,0 +1,18 @@
1
+ declare const _default: {
2
+ limitedModeTitle: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ limitedModeDescriptionWithLink: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ limitedModeDescriptionWithoutLink: {
13
+ id: string;
14
+ defaultMessage: string;
15
+ description: string;
16
+ };
17
+ };
18
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-limited-mode",
3
- "version": "1.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "LimitedMode plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,11 +29,14 @@
29
29
  "atlaskit:src": "src/index.ts",
30
30
  "dependencies": {
31
31
  "@atlaskit/editor-prosemirror": "7.0.0",
32
- "@atlaskit/tmp-editor-statsig": "^12.5.0",
33
- "@babel/runtime": "^7.0.0"
32
+ "@atlaskit/primitives": "^14.14.0",
33
+ "@atlaskit/tmp-editor-statsig": "^12.24.0",
34
+ "@babel/runtime": "^7.0.0",
35
+ "bind-event-listener": "^3.0.0",
36
+ "react-intl-next": "npm:react-intl@^5.18.1"
34
37
  },
35
38
  "peerDependencies": {
36
- "@atlaskit/editor-common": "^108.3.0",
39
+ "@atlaskit/editor-common": "^109.8.0",
37
40
  "react": "^18.2.0"
38
41
  },
39
42
  "devDependencies": {