@atlaskit/editor-plugin-synced-block 4.4.1 → 4.5.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/dist/cjs/editor-commands/index.js +19 -5
  4. package/dist/cjs/nodeviews/syncedBlock.js +2 -1
  5. package/dist/cjs/pm-plugins/main.js +42 -2
  6. package/dist/cjs/syncedBlockPlugin.js +1 -1
  7. package/dist/cjs/types/index.js +1 -0
  8. package/dist/cjs/ui/Flag.js +49 -14
  9. package/dist/cjs/ui/SyncBlockRendererWrapper.js +4 -2
  10. package/dist/cjs/ui/floating-toolbar.js +1 -1
  11. package/dist/cjs/ui/toolbar-components.js +9 -29
  12. package/dist/es2019/editor-commands/index.js +20 -5
  13. package/dist/es2019/nodeviews/syncedBlock.js +2 -1
  14. package/dist/es2019/pm-plugins/main.js +42 -1
  15. package/dist/es2019/syncedBlockPlugin.js +1 -1
  16. package/dist/es2019/types/index.js +1 -0
  17. package/dist/es2019/ui/Flag.js +50 -14
  18. package/dist/es2019/ui/SyncBlockRendererWrapper.js +4 -2
  19. package/dist/es2019/ui/floating-toolbar.js +1 -1
  20. package/dist/es2019/ui/toolbar-components.js +9 -31
  21. package/dist/esm/editor-commands/index.js +19 -5
  22. package/dist/esm/nodeviews/syncedBlock.js +2 -1
  23. package/dist/esm/pm-plugins/main.js +42 -3
  24. package/dist/esm/syncedBlockPlugin.js +1 -1
  25. package/dist/esm/types/index.js +1 -0
  26. package/dist/esm/ui/Flag.js +50 -15
  27. package/dist/esm/ui/SyncBlockRendererWrapper.js +4 -2
  28. package/dist/esm/ui/floating-toolbar.js +1 -1
  29. package/dist/esm/ui/toolbar-components.js +10 -30
  30. package/dist/types/editor-commands/index.d.ts +2 -2
  31. package/dist/types/syncedBlockPluginType.d.ts +2 -1
  32. package/dist/types/types/index.d.ts +2 -1
  33. package/dist/types/ui/SyncBlockRendererWrapper.d.ts +5 -3
  34. package/dist/types-ts4.5/editor-commands/index.d.ts +2 -2
  35. package/dist/types-ts4.5/syncedBlockPluginType.d.ts +2 -1
  36. package/dist/types-ts4.5/types/index.d.ts +2 -1
  37. package/dist/types-ts4.5/ui/SyncBlockRendererWrapper.d.ts +5 -3
  38. package/package.json +3 -2
  39. package/dist/cjs/ui/CreateSyncedBlockItem.js +0 -53
  40. package/dist/cjs/ui/OverflowMenuSection.js +0 -20
  41. package/dist/es2019/ui/CreateSyncedBlockItem.js +0 -46
  42. package/dist/es2019/ui/OverflowMenuSection.js +0 -15
  43. package/dist/esm/ui/CreateSyncedBlockItem.js +0 -44
  44. package/dist/esm/ui/OverflowMenuSection.js +0 -13
  45. package/dist/types/ui/CreateSyncedBlockItem.d.ts +0 -8
  46. package/dist/types/ui/OverflowMenuSection.d.ts +0 -6
  47. package/dist/types-ts4.5/ui/CreateSyncedBlockItem.d.ts +0 -8
  48. package/dist/types-ts4.5/ui/OverflowMenuSection.d.ts +0 -6
@@ -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,6 +0,0 @@
1
- import React from 'react';
2
- type OverflowMenuSectionProps = {
3
- children: React.ReactNode;
4
- };
5
- export declare const OverflowMenuSection: ({ children, }: OverflowMenuSectionProps) => React.JSX.Element | null;
6
- 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 {};
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- type OverflowMenuSectionProps = {
3
- children: React.ReactNode;
4
- };
5
- export declare const OverflowMenuSection: ({ children, }: OverflowMenuSectionProps) => React.JSX.Element | null;
6
- export {};