@atlaskit/editor-plugin-synced-block 4.5.0 → 4.5.2
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 +18 -0
- package/afm-cc/tsconfig.json +9 -0
- package/afm-jira/tsconfig.json +9 -0
- package/afm-products/tsconfig.json +9 -0
- package/dist/cjs/editor-actions/index.js +4 -1
- package/dist/cjs/editor-commands/index.js +19 -5
- package/dist/cjs/pm-plugins/main.js +24 -18
- package/dist/cjs/syncedBlockPlugin.js +4 -1
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/ui/Flag.js +49 -14
- package/dist/cjs/ui/floating-toolbar.js +1 -1
- package/dist/cjs/ui/toolbar-components.js +9 -29
- package/dist/es2019/editor-actions/index.js +3 -0
- package/dist/es2019/editor-commands/index.js +20 -5
- package/dist/es2019/pm-plugins/main.js +24 -17
- package/dist/es2019/syncedBlockPlugin.js +5 -2
- package/dist/es2019/types/index.js +1 -0
- package/dist/es2019/ui/Flag.js +50 -14
- package/dist/es2019/ui/floating-toolbar.js +1 -1
- package/dist/es2019/ui/toolbar-components.js +9 -31
- package/dist/esm/editor-actions/index.js +3 -0
- package/dist/esm/editor-commands/index.js +19 -5
- package/dist/esm/pm-plugins/main.js +24 -18
- package/dist/esm/syncedBlockPlugin.js +5 -2
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/ui/Flag.js +50 -15
- package/dist/esm/ui/floating-toolbar.js +1 -1
- package/dist/esm/ui/toolbar-components.js +10 -30
- package/dist/types/editor-actions/index.d.ts +1 -0
- package/dist/types/editor-commands/index.d.ts +2 -2
- package/dist/types/syncedBlockPluginType.d.ts +8 -0
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types-ts4.5/editor-actions/index.d.ts +1 -0
- package/dist/types-ts4.5/editor-commands/index.d.ts +2 -2
- package/dist/types-ts4.5/syncedBlockPluginType.d.ts +8 -0
- package/dist/types-ts4.5/types/index.d.ts +2 -1
- package/package.json +4 -3
- package/dist/cjs/ui/CreateSyncedBlockItem.js +0 -53
- package/dist/cjs/ui/OverflowMenuSection.js +0 -20
- package/dist/es2019/ui/CreateSyncedBlockItem.js +0 -46
- package/dist/es2019/ui/OverflowMenuSection.js +0 -15
- package/dist/esm/ui/CreateSyncedBlockItem.js +0 -44
- package/dist/esm/ui/OverflowMenuSection.js +0 -13
- package/dist/types/ui/CreateSyncedBlockItem.d.ts +0 -8
- package/dist/types/ui/OverflowMenuSection.d.ts +0 -6
- package/dist/types-ts4.5/ui/CreateSyncedBlockItem.d.ts +0 -8
- package/dist/types-ts4.5/ui/OverflowMenuSection.d.ts +0 -6
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.CreateSyncedBlockItem = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _reactIntlNext = require("react-intl-next");
|
|
11
|
-
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
|
-
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
-
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
14
|
-
var _blockSynced = _interopRequireDefault(require("@atlaskit/icon-lab/core/block-synced"));
|
|
15
|
-
var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
|
|
16
|
-
var _utils = require("../pm-plugins/utils/utils");
|
|
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 CreateSyncedBlockItem = exports.CreateSyncedBlockItem = function CreateSyncedBlockItem(_ref) {
|
|
19
|
-
var api = _ref.api;
|
|
20
|
-
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
21
|
-
formatMessage = _useIntl.formatMessage;
|
|
22
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['selection', 'connectivity'], function (states) {
|
|
23
|
-
var _states$selectionStat, _states$connectivityS;
|
|
24
|
-
return {
|
|
25
|
-
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection,
|
|
26
|
-
mode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
|
|
27
|
-
};
|
|
28
|
-
}),
|
|
29
|
-
selection = _useSharedPluginState.selection,
|
|
30
|
-
mode = _useSharedPluginState.mode;
|
|
31
|
-
var isDisabled = Boolean(!selection || !(0, _utils.canBeConvertedToSyncBlock)(selection) || mode === 'offline');
|
|
32
|
-
var onClick = (0, _react.useCallback)(function () {
|
|
33
|
-
var _api$core, _api$core2;
|
|
34
|
-
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
|
|
35
|
-
var tr = _ref2.tr;
|
|
36
|
-
return api === null || api === void 0 ? void 0 : api.syncedBlock.commands.insertSyncedBlock()({
|
|
37
|
-
tr: tr
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.focus();
|
|
41
|
-
}, [api]);
|
|
42
|
-
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
43
|
-
onClick: onClick,
|
|
44
|
-
isDisabled: isDisabled,
|
|
45
|
-
elemBefore: /*#__PURE__*/_react.default.createElement(_blockSynced.default, {
|
|
46
|
-
size: "small",
|
|
47
|
-
label: ""
|
|
48
|
-
}),
|
|
49
|
-
elemAfter: /*#__PURE__*/_react.default.createElement(_lozenge.default, {
|
|
50
|
-
appearance: "new"
|
|
51
|
-
}, formatMessage(_messages.syncBlockMessages.newLozenge))
|
|
52
|
-
}, formatMessage(_messages.syncBlockMessages.createSyncBlockLabel));
|
|
53
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.OverflowMenuSection = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
10
|
-
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
11
|
-
var OverflowMenuSection = exports.OverflowMenuSection = function OverflowMenuSection(_ref) {
|
|
12
|
-
var children = _ref.children;
|
|
13
|
-
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
14
|
-
editorViewMode = _useEditorToolbar.editorViewMode;
|
|
15
|
-
var isEdit = editorViewMode === 'edit';
|
|
16
|
-
if (!isEdit) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, null, children);
|
|
20
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
|
-
import { syncBlockMessages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
6
|
-
import BlockSyncedIcon from '@atlaskit/icon-lab/core/block-synced';
|
|
7
|
-
import Lozenge from '@atlaskit/lozenge';
|
|
8
|
-
import { canBeConvertedToSyncBlock } from '../pm-plugins/utils/utils';
|
|
9
|
-
export const CreateSyncedBlockItem = ({
|
|
10
|
-
api
|
|
11
|
-
}) => {
|
|
12
|
-
const {
|
|
13
|
-
formatMessage
|
|
14
|
-
} = useIntl();
|
|
15
|
-
const {
|
|
16
|
-
selection,
|
|
17
|
-
mode
|
|
18
|
-
} = useSharedPluginStateWithSelector(api, ['selection', 'connectivity'], states => {
|
|
19
|
-
var _states$selectionStat, _states$connectivityS;
|
|
20
|
-
return {
|
|
21
|
-
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection,
|
|
22
|
-
mode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
const isDisabled = Boolean(!selection || !canBeConvertedToSyncBlock(selection) || mode === 'offline');
|
|
26
|
-
const onClick = useCallback(() => {
|
|
27
|
-
var _api$core, _api$core2;
|
|
28
|
-
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(({
|
|
29
|
-
tr
|
|
30
|
-
}) => api === null || api === void 0 ? void 0 : api.syncedBlock.commands.insertSyncedBlock()({
|
|
31
|
-
tr
|
|
32
|
-
}));
|
|
33
|
-
api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.focus();
|
|
34
|
-
}, [api]);
|
|
35
|
-
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
36
|
-
onClick: onClick,
|
|
37
|
-
isDisabled: isDisabled,
|
|
38
|
-
elemBefore: /*#__PURE__*/React.createElement(BlockSyncedIcon, {
|
|
39
|
-
size: "small",
|
|
40
|
-
label: ""
|
|
41
|
-
}),
|
|
42
|
-
elemAfter: /*#__PURE__*/React.createElement(Lozenge, {
|
|
43
|
-
appearance: "new"
|
|
44
|
-
}, formatMessage(syncBlockMessages.newLozenge))
|
|
45
|
-
}, formatMessage(syncBlockMessages.createSyncBlockLabel));
|
|
46
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
3
|
-
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
4
|
-
export const OverflowMenuSection = ({
|
|
5
|
-
children
|
|
6
|
-
}) => {
|
|
7
|
-
const {
|
|
8
|
-
editorViewMode
|
|
9
|
-
} = useEditorToolbar();
|
|
10
|
-
const isEdit = editorViewMode === 'edit';
|
|
11
|
-
if (!isEdit) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, children);
|
|
15
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
|
-
import { syncBlockMessages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
6
|
-
import BlockSyncedIcon from '@atlaskit/icon-lab/core/block-synced';
|
|
7
|
-
import Lozenge from '@atlaskit/lozenge';
|
|
8
|
-
import { canBeConvertedToSyncBlock } from '../pm-plugins/utils/utils';
|
|
9
|
-
export var CreateSyncedBlockItem = function CreateSyncedBlockItem(_ref) {
|
|
10
|
-
var api = _ref.api;
|
|
11
|
-
var _useIntl = useIntl(),
|
|
12
|
-
formatMessage = _useIntl.formatMessage;
|
|
13
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection', 'connectivity'], function (states) {
|
|
14
|
-
var _states$selectionStat, _states$connectivityS;
|
|
15
|
-
return {
|
|
16
|
-
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection,
|
|
17
|
-
mode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
|
|
18
|
-
};
|
|
19
|
-
}),
|
|
20
|
-
selection = _useSharedPluginState.selection,
|
|
21
|
-
mode = _useSharedPluginState.mode;
|
|
22
|
-
var isDisabled = Boolean(!selection || !canBeConvertedToSyncBlock(selection) || mode === 'offline');
|
|
23
|
-
var onClick = useCallback(function () {
|
|
24
|
-
var _api$core, _api$core2;
|
|
25
|
-
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
|
|
26
|
-
var tr = _ref2.tr;
|
|
27
|
-
return api === null || api === void 0 ? void 0 : api.syncedBlock.commands.insertSyncedBlock()({
|
|
28
|
-
tr: tr
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.focus();
|
|
32
|
-
}, [api]);
|
|
33
|
-
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
34
|
-
onClick: onClick,
|
|
35
|
-
isDisabled: isDisabled,
|
|
36
|
-
elemBefore: /*#__PURE__*/React.createElement(BlockSyncedIcon, {
|
|
37
|
-
size: "small",
|
|
38
|
-
label: ""
|
|
39
|
-
}),
|
|
40
|
-
elemAfter: /*#__PURE__*/React.createElement(Lozenge, {
|
|
41
|
-
appearance: "new"
|
|
42
|
-
}, formatMessage(syncBlockMessages.newLozenge))
|
|
43
|
-
}, formatMessage(syncBlockMessages.createSyncBlockLabel));
|
|
44
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
3
|
-
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
4
|
-
export var OverflowMenuSection = function OverflowMenuSection(_ref) {
|
|
5
|
-
var children = _ref.children;
|
|
6
|
-
var _useEditorToolbar = useEditorToolbar(),
|
|
7
|
-
editorViewMode = _useEditorToolbar.editorViewMode;
|
|
8
|
-
var isEdit = editorViewMode === 'edit';
|
|
9
|
-
if (!isEdit) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, children);
|
|
13
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
|
|
4
|
-
type CreateSyncedBlockItemProps = {
|
|
5
|
-
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
|
|
6
|
-
};
|
|
7
|
-
export declare const CreateSyncedBlockItem: ({ api }: CreateSyncedBlockItemProps) => React.JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
|
|
4
|
-
type CreateSyncedBlockItemProps = {
|
|
5
|
-
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
|
|
6
|
-
};
|
|
7
|
-
export declare const CreateSyncedBlockItem: ({ api }: CreateSyncedBlockItemProps) => React.JSX.Element;
|
|
8
|
-
export {};
|