@atlaskit/editor-core 189.1.13 → 189.2.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.
Files changed (208) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/composable-editor/editor-internal.js +22 -1
  3. package/dist/cjs/create-editor/feature-flags-from-props.js +4 -5
  4. package/dist/cjs/i18n/cs.js +0 -1
  5. package/dist/cjs/i18n/da.js +0 -1
  6. package/dist/cjs/i18n/de.js +0 -1
  7. package/dist/cjs/i18n/en.js +0 -1
  8. package/dist/cjs/i18n/en_GB.js +0 -1
  9. package/dist/cjs/i18n/en_ZZ.js +0 -1
  10. package/dist/cjs/i18n/es.js +0 -1
  11. package/dist/cjs/i18n/fi.js +0 -1
  12. package/dist/cjs/i18n/fr.js +0 -1
  13. package/dist/cjs/i18n/hu.js +0 -1
  14. package/dist/cjs/i18n/it.js +0 -1
  15. package/dist/cjs/i18n/ja.js +0 -1
  16. package/dist/cjs/i18n/ko.js +0 -1
  17. package/dist/cjs/i18n/nb.js +0 -1
  18. package/dist/cjs/i18n/nl.js +0 -1
  19. package/dist/cjs/i18n/pl.js +0 -1
  20. package/dist/cjs/i18n/pt_BR.js +0 -1
  21. package/dist/cjs/i18n/ru.js +0 -1
  22. package/dist/cjs/i18n/sv.js +0 -1
  23. package/dist/cjs/i18n/th.js +0 -1
  24. package/dist/cjs/i18n/tr.js +0 -1
  25. package/dist/cjs/i18n/uk.js +0 -1
  26. package/dist/cjs/i18n/vi.js +0 -1
  27. package/dist/cjs/i18n/zh.js +0 -1
  28. package/dist/cjs/i18n/zh_TW.js +0 -1
  29. package/dist/cjs/plugins/index.js +0 -7
  30. package/dist/cjs/presets/universal.js +3 -2
  31. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +10 -8
  32. package/dist/cjs/ui/ContentStyles/index.js +7 -7
  33. package/dist/cjs/version-wrapper.js +1 -1
  34. package/dist/es2019/composable-editor/editor-internal.js +25 -2
  35. package/dist/es2019/create-editor/feature-flags-from-props.js +4 -5
  36. package/dist/es2019/i18n/cs.js +0 -1
  37. package/dist/es2019/i18n/da.js +0 -1
  38. package/dist/es2019/i18n/de.js +0 -1
  39. package/dist/es2019/i18n/en.js +0 -1
  40. package/dist/es2019/i18n/en_GB.js +0 -1
  41. package/dist/es2019/i18n/en_ZZ.js +0 -1
  42. package/dist/es2019/i18n/es.js +0 -1
  43. package/dist/es2019/i18n/fi.js +0 -1
  44. package/dist/es2019/i18n/fr.js +0 -1
  45. package/dist/es2019/i18n/hu.js +0 -1
  46. package/dist/es2019/i18n/it.js +0 -1
  47. package/dist/es2019/i18n/ja.js +0 -1
  48. package/dist/es2019/i18n/ko.js +0 -1
  49. package/dist/es2019/i18n/nb.js +0 -1
  50. package/dist/es2019/i18n/nl.js +0 -1
  51. package/dist/es2019/i18n/pl.js +0 -1
  52. package/dist/es2019/i18n/pt_BR.js +0 -1
  53. package/dist/es2019/i18n/ru.js +0 -1
  54. package/dist/es2019/i18n/sv.js +0 -1
  55. package/dist/es2019/i18n/th.js +0 -1
  56. package/dist/es2019/i18n/tr.js +0 -1
  57. package/dist/es2019/i18n/uk.js +0 -1
  58. package/dist/es2019/i18n/vi.js +0 -1
  59. package/dist/es2019/i18n/zh.js +0 -1
  60. package/dist/es2019/i18n/zh_TW.js +0 -1
  61. package/dist/es2019/plugins/index.js +0 -1
  62. package/dist/es2019/presets/universal.js +3 -2
  63. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +10 -8
  64. package/dist/es2019/ui/ContentStyles/index.js +1 -1
  65. package/dist/es2019/version-wrapper.js +1 -1
  66. package/dist/esm/composable-editor/editor-internal.js +23 -2
  67. package/dist/esm/create-editor/feature-flags-from-props.js +4 -5
  68. package/dist/esm/i18n/cs.js +0 -1
  69. package/dist/esm/i18n/da.js +0 -1
  70. package/dist/esm/i18n/de.js +0 -1
  71. package/dist/esm/i18n/en.js +0 -1
  72. package/dist/esm/i18n/en_GB.js +0 -1
  73. package/dist/esm/i18n/en_ZZ.js +0 -1
  74. package/dist/esm/i18n/es.js +0 -1
  75. package/dist/esm/i18n/fi.js +0 -1
  76. package/dist/esm/i18n/fr.js +0 -1
  77. package/dist/esm/i18n/hu.js +0 -1
  78. package/dist/esm/i18n/it.js +0 -1
  79. package/dist/esm/i18n/ja.js +0 -1
  80. package/dist/esm/i18n/ko.js +0 -1
  81. package/dist/esm/i18n/nb.js +0 -1
  82. package/dist/esm/i18n/nl.js +0 -1
  83. package/dist/esm/i18n/pl.js +0 -1
  84. package/dist/esm/i18n/pt_BR.js +0 -1
  85. package/dist/esm/i18n/ru.js +0 -1
  86. package/dist/esm/i18n/sv.js +0 -1
  87. package/dist/esm/i18n/th.js +0 -1
  88. package/dist/esm/i18n/tr.js +0 -1
  89. package/dist/esm/i18n/uk.js +0 -1
  90. package/dist/esm/i18n/vi.js +0 -1
  91. package/dist/esm/i18n/zh.js +0 -1
  92. package/dist/esm/i18n/zh_TW.js +0 -1
  93. package/dist/esm/plugins/index.js +0 -1
  94. package/dist/esm/presets/universal.js +3 -2
  95. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +10 -8
  96. package/dist/esm/ui/ContentStyles/index.js +1 -1
  97. package/dist/esm/version-wrapper.js +1 -1
  98. package/dist/types/create-editor/get-ui-component.d.ts +1 -1
  99. package/dist/types/i18n/cs.d.ts +0 -1
  100. package/dist/types/i18n/da.d.ts +0 -1
  101. package/dist/types/i18n/de.d.ts +0 -1
  102. package/dist/types/i18n/en.d.ts +0 -1
  103. package/dist/types/i18n/en_GB.d.ts +0 -1
  104. package/dist/types/i18n/en_ZZ.d.ts +0 -1
  105. package/dist/types/i18n/es.d.ts +0 -1
  106. package/dist/types/i18n/fi.d.ts +0 -1
  107. package/dist/types/i18n/fr.d.ts +0 -1
  108. package/dist/types/i18n/hu.d.ts +0 -1
  109. package/dist/types/i18n/it.d.ts +0 -1
  110. package/dist/types/i18n/ja.d.ts +0 -1
  111. package/dist/types/i18n/ko.d.ts +0 -1
  112. package/dist/types/i18n/nb.d.ts +0 -1
  113. package/dist/types/i18n/nl.d.ts +0 -1
  114. package/dist/types/i18n/pl.d.ts +0 -1
  115. package/dist/types/i18n/pt_BR.d.ts +0 -1
  116. package/dist/types/i18n/ru.d.ts +0 -1
  117. package/dist/types/i18n/sv.d.ts +0 -1
  118. package/dist/types/i18n/th.d.ts +0 -1
  119. package/dist/types/i18n/tr.d.ts +0 -1
  120. package/dist/types/i18n/uk.d.ts +0 -1
  121. package/dist/types/i18n/vi.d.ts +0 -1
  122. package/dist/types/i18n/zh.d.ts +0 -1
  123. package/dist/types/i18n/zh_TW.d.ts +0 -1
  124. package/dist/types/plugins/index.d.ts +0 -1
  125. package/dist/types/plugins/insert-block/types.d.ts +1 -1
  126. package/dist/types/types/editor-props.d.ts +1 -1
  127. package/dist/types/{plugins/panel/styles.d.ts → ui/ContentStyles/panel.d.ts} +1 -1
  128. package/dist/types-ts4.5/create-editor/get-ui-component.d.ts +1 -1
  129. package/dist/types-ts4.5/i18n/cs.d.ts +0 -1
  130. package/dist/types-ts4.5/i18n/da.d.ts +0 -1
  131. package/dist/types-ts4.5/i18n/de.d.ts +0 -1
  132. package/dist/types-ts4.5/i18n/en.d.ts +0 -1
  133. package/dist/types-ts4.5/i18n/en_GB.d.ts +0 -1
  134. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +0 -1
  135. package/dist/types-ts4.5/i18n/es.d.ts +0 -1
  136. package/dist/types-ts4.5/i18n/fi.d.ts +0 -1
  137. package/dist/types-ts4.5/i18n/fr.d.ts +0 -1
  138. package/dist/types-ts4.5/i18n/hu.d.ts +0 -1
  139. package/dist/types-ts4.5/i18n/it.d.ts +0 -1
  140. package/dist/types-ts4.5/i18n/ja.d.ts +0 -1
  141. package/dist/types-ts4.5/i18n/ko.d.ts +0 -1
  142. package/dist/types-ts4.5/i18n/nb.d.ts +0 -1
  143. package/dist/types-ts4.5/i18n/nl.d.ts +0 -1
  144. package/dist/types-ts4.5/i18n/pl.d.ts +0 -1
  145. package/dist/types-ts4.5/i18n/pt_BR.d.ts +0 -1
  146. package/dist/types-ts4.5/i18n/ru.d.ts +0 -1
  147. package/dist/types-ts4.5/i18n/sv.d.ts +0 -1
  148. package/dist/types-ts4.5/i18n/th.d.ts +0 -1
  149. package/dist/types-ts4.5/i18n/tr.d.ts +0 -1
  150. package/dist/types-ts4.5/i18n/uk.d.ts +0 -1
  151. package/dist/types-ts4.5/i18n/vi.d.ts +0 -1
  152. package/dist/types-ts4.5/i18n/zh.d.ts +0 -1
  153. package/dist/types-ts4.5/i18n/zh_TW.d.ts +0 -1
  154. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  155. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +1 -1
  156. package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
  157. package/dist/types-ts4.5/{plugins/panel/styles.d.ts → ui/ContentStyles/panel.d.ts} +1 -1
  158. package/package.json +6 -5
  159. package/report.api.md +1 -8
  160. package/tmp/api-report-tmp.d.ts +1 -8
  161. package/dist/cjs/plugins/panel/actions.js +0 -125
  162. package/dist/cjs/plugins/panel/index.js +0 -215
  163. package/dist/cjs/plugins/panel/message.js +0 -44
  164. package/dist/cjs/plugins/panel/nodeviews/panel.js +0 -94
  165. package/dist/cjs/plugins/panel/pm-plugins/keymaps.js +0 -81
  166. package/dist/cjs/plugins/panel/pm-plugins/main.js +0 -28
  167. package/dist/cjs/plugins/panel/toolbar.js +0 -293
  168. package/dist/cjs/plugins/panel/types.js +0 -8
  169. package/dist/cjs/plugins/panel/utils.js +0 -53
  170. package/dist/es2019/plugins/panel/actions.js +0 -116
  171. package/dist/es2019/plugins/panel/index.js +0 -192
  172. package/dist/es2019/plugins/panel/message.js +0 -38
  173. package/dist/es2019/plugins/panel/nodeviews/panel.js +0 -82
  174. package/dist/es2019/plugins/panel/pm-plugins/keymaps.js +0 -82
  175. package/dist/es2019/plugins/panel/pm-plugins/main.js +0 -21
  176. package/dist/es2019/plugins/panel/toolbar.js +0 -280
  177. package/dist/es2019/plugins/panel/types.js +0 -2
  178. package/dist/es2019/plugins/panel/utils.js +0 -48
  179. package/dist/esm/plugins/panel/actions.js +0 -116
  180. package/dist/esm/plugins/panel/index.js +0 -209
  181. package/dist/esm/plugins/panel/message.js +0 -38
  182. package/dist/esm/plugins/panel/nodeviews/panel.js +0 -87
  183. package/dist/esm/plugins/panel/pm-plugins/keymaps.js +0 -74
  184. package/dist/esm/plugins/panel/pm-plugins/main.js +0 -22
  185. package/dist/esm/plugins/panel/toolbar.js +0 -287
  186. package/dist/esm/plugins/panel/types.js +0 -2
  187. package/dist/esm/plugins/panel/utils.js +0 -46
  188. package/dist/types/plugins/panel/actions.d.ts +0 -12
  189. package/dist/types/plugins/panel/index.d.ts +0 -17
  190. package/dist/types/plugins/panel/message.d.ts +0 -37
  191. package/dist/types/plugins/panel/nodeviews/panel.d.ts +0 -36
  192. package/dist/types/plugins/panel/pm-plugins/keymaps.d.ts +0 -3
  193. package/dist/types/plugins/panel/pm-plugins/main.d.ts +0 -11
  194. package/dist/types/plugins/panel/toolbar.d.ts +0 -16
  195. package/dist/types/plugins/panel/types.d.ts +0 -21
  196. package/dist/types/plugins/panel/utils.d.ts +0 -5
  197. package/dist/types-ts4.5/plugins/panel/actions.d.ts +0 -12
  198. package/dist/types-ts4.5/plugins/panel/index.d.ts +0 -17
  199. package/dist/types-ts4.5/plugins/panel/message.d.ts +0 -37
  200. package/dist/types-ts4.5/plugins/panel/nodeviews/panel.d.ts +0 -36
  201. package/dist/types-ts4.5/plugins/panel/pm-plugins/keymaps.d.ts +0 -3
  202. package/dist/types-ts4.5/plugins/panel/pm-plugins/main.d.ts +0 -11
  203. package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +0 -16
  204. package/dist/types-ts4.5/plugins/panel/types.d.ts +0 -21
  205. package/dist/types-ts4.5/plugins/panel/utils.d.ts +0 -5
  206. /package/dist/cjs/{plugins/panel/styles.js → ui/ContentStyles/panel.js} +0 -0
  207. /package/dist/es2019/{plugins/panel/styles.js → ui/ContentStyles/panel.js} +0 -0
  208. /package/dist/esm/{plugins/panel/styles.js → ui/ContentStyles/panel.js} +0 -0
@@ -1,287 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- var _panelIconMap;
3
- 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; }
4
- 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; }
5
- import SuccessIcon from '@atlaskit/icon/glyph/editor/success';
6
- import InfoIcon from '@atlaskit/icon/glyph/editor/info';
7
- import NoteIcon from '@atlaskit/icon/glyph/editor/note';
8
- import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
9
- import WarningIcon from '@atlaskit/icon/glyph/editor/warning';
10
- import ErrorIcon from '@atlaskit/icon/glyph/editor/error';
11
- import RemoveEmojiIcon from '@atlaskit/icon/glyph/editor/remove-emoji';
12
- import commonMessages from '../../messages';
13
- import { removePanel, changePanelType } from './actions';
14
- import { panelBackgroundPalette } from '@atlaskit/editor-common/ui-color';
15
- import { getPanelTypeBackgroundNoTokens } from '@atlaskit/editor-common/panel';
16
- import { findPanel } from './utils';
17
- import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
18
- import { DEFAULT_BORDER_COLOR } from '@atlaskit/editor-common/ui-color';
19
- import { PanelType } from '@atlaskit/adf-schema';
20
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
21
- import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
22
- import { messages } from './message';
23
- export var panelIconMap = (_panelIconMap = {}, _defineProperty(_panelIconMap, PanelType.INFO, {
24
- shortName: ':info:',
25
- id: 'atlassian-info'
26
- }), _defineProperty(_panelIconMap, PanelType.NOTE, {
27
- shortName: ':note:',
28
- id: 'atlassian-note'
29
- }), _defineProperty(_panelIconMap, PanelType.WARNING, {
30
- shortName: ':warning:',
31
- id: 'atlassian-warning'
32
- }), _defineProperty(_panelIconMap, PanelType.ERROR, {
33
- shortName: ':cross_mark:',
34
- id: 'atlassian-cross_mark'
35
- }), _defineProperty(_panelIconMap, PanelType.SUCCESS, {
36
- shortName: ':check_mark:',
37
- id: 'atlassian-check_mark'
38
- }), _defineProperty(_panelIconMap, PanelType.TIP, {
39
- shortName: ':tip:',
40
- id: 'atlassian-tip'
41
- }), _panelIconMap);
42
- export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, hoverDecoration, editorAnalyticsAPI, activePanelType, activePanelColor, activePanelIcon, state) {
43
- // TODO: ED-14403 investigate why these titles are not getting translated for the tooltips
44
- var items = [{
45
- id: 'editor.panel.info',
46
- type: 'button',
47
- icon: InfoIcon,
48
- onClick: changePanelType(editorAnalyticsAPI)(PanelType.INFO),
49
- selected: activePanelType === PanelType.INFO,
50
- title: formatMessage(messages.info),
51
- tabIndex: null
52
- }, {
53
- id: 'editor.panel.note',
54
- type: 'button',
55
- icon: NoteIcon,
56
- onClick: changePanelType(editorAnalyticsAPI)(PanelType.NOTE),
57
- selected: activePanelType === PanelType.NOTE,
58
- title: formatMessage(messages.note),
59
- tabIndex: null
60
- }, {
61
- id: 'editor.panel.success',
62
- type: 'button',
63
- icon: SuccessIcon,
64
- onClick: changePanelType(editorAnalyticsAPI)(PanelType.SUCCESS),
65
- selected: activePanelType === PanelType.SUCCESS,
66
- title: formatMessage(messages.success),
67
- tabIndex: null
68
- }, {
69
- id: 'editor.panel.warning',
70
- type: 'button',
71
- icon: WarningIcon,
72
- onClick: changePanelType(editorAnalyticsAPI)(PanelType.WARNING),
73
- selected: activePanelType === PanelType.WARNING,
74
- title: formatMessage(messages.warning),
75
- tabIndex: null
76
- }, {
77
- id: 'editor.panel.error',
78
- type: 'button',
79
- icon: ErrorIcon,
80
- onClick: changePanelType(editorAnalyticsAPI)(PanelType.ERROR),
81
- selected: activePanelType === PanelType.ERROR,
82
- title: formatMessage(messages.error),
83
- tabIndex: null
84
- }];
85
- if (isCustomPanelEnabled) {
86
- var changeColor = function changeColor(color) {
87
- return function (state, dispatch) {
88
- var panelNode = findPanel(state);
89
- if (panelNode === undefined) {
90
- return false;
91
- }
92
- var previousColor = panelNode.node.attrs.panelType === 'custom' ? panelNode.node.attrs.panelColor || 'none' : getPanelTypeBackgroundNoTokens(panelNode.node.attrs.panelType);
93
- var emojiInfo = panelNode.node.attrs.panelType;
94
- var panelEmoji = panelIconMap[emojiInfo];
95
- var previousEmoji = panelEmoji ? {
96
- emoji: panelEmoji.shortName,
97
- emojiId: panelEmoji.id
98
- } : {};
99
- if (previousColor === color) {
100
- changePanelType(editorAnalyticsAPI)(PanelType.CUSTOM, _objectSpread({
101
- color: color
102
- }, previousEmoji), isCustomPanelEnabled)(state, dispatch);
103
- return false;
104
- }
105
- var payload = {
106
- action: ACTION.CHANGED_BACKGROUND_COLOR,
107
- actionSubject: ACTION_SUBJECT.PANEL,
108
- actionSubjectId: ACTION_SUBJECT_ID.PANEL,
109
- attributes: {
110
- newColor: color,
111
- previousColor: previousColor
112
- },
113
- eventType: EVENT_TYPE.TRACK
114
- };
115
- withAnalytics(editorAnalyticsAPI, payload)(changePanelType(editorAnalyticsAPI)(PanelType.CUSTOM, _objectSpread({
116
- color: color
117
- }, previousEmoji), isCustomPanelEnabled))(state, dispatch);
118
- return false;
119
- };
120
- };
121
- var changeEmoji = function changeEmoji(emoji) {
122
- return function (state, dispatch) {
123
- var panelNode = findPanel(state);
124
- if (panelNode === undefined) {
125
- return false;
126
- }
127
- var previousIcon = panelNode.node.attrs.panelIcon || '';
128
- if (previousIcon === emoji.shortName) {
129
- changePanelType(editorAnalyticsAPI)(PanelType.CUSTOM, {
130
- emoji: emoji.shortName,
131
- emojiId: emoji.id,
132
- emojiText: emoji.fallback
133
- }, true)(state, dispatch);
134
- return false;
135
- }
136
- var payload = {
137
- action: ACTION.CHANGED_ICON,
138
- actionSubject: ACTION_SUBJECT.PANEL,
139
- actionSubjectId: ACTION_SUBJECT_ID.PANEL,
140
- attributes: {
141
- newIcon: emoji.shortName,
142
- previousIcon: previousIcon
143
- },
144
- eventType: EVENT_TYPE.TRACK
145
- };
146
- withAnalytics(editorAnalyticsAPI, payload)(changePanelType(editorAnalyticsAPI)(PanelType.CUSTOM, {
147
- emoji: emoji.shortName,
148
- emojiId: emoji.id,
149
- emojiText: emoji.fallback
150
- }, true))(state, dispatch);
151
- return false;
152
- };
153
- };
154
- var removeEmoji = function removeEmoji() {
155
- return function (state, dispatch) {
156
- var panelNode = findPanel(state);
157
- if (activePanelType === PanelType.CUSTOM && !activePanelIcon) {
158
- return false;
159
- }
160
- if (panelNode === undefined) {
161
- return false;
162
- }
163
- var payload = {
164
- action: ACTION.REMOVE_ICON,
165
- actionSubject: ACTION_SUBJECT.PANEL,
166
- actionSubjectId: ACTION_SUBJECT_ID.PANEL,
167
- attributes: {
168
- icon: panelNode.node.attrs.panelIcon
169
- },
170
- eventType: EVENT_TYPE.TRACK
171
- };
172
- withAnalytics(editorAnalyticsAPI, payload)(changePanelType(editorAnalyticsAPI)(PanelType.CUSTOM, {
173
- emoji: undefined,
174
- emojiId: undefined,
175
- emojiText: undefined
176
- }, isCustomPanelEnabled))(state, dispatch);
177
- return false;
178
- };
179
- };
180
- var panelColor = activePanelType === PanelType.CUSTOM ? activePanelColor || getPanelTypeBackgroundNoTokens(PanelType.INFO) : getPanelTypeBackgroundNoTokens(activePanelType);
181
- var defaultPalette = panelBackgroundPalette.find(function (item) {
182
- return item.value === panelColor;
183
- }) || {
184
- label: 'Custom',
185
- value: panelColor,
186
- border: DEFAULT_BORDER_COLOR
187
- };
188
- if (isCustomPanelEditable) {
189
- var colorPicker = {
190
- id: 'editor.panel.colorPicker',
191
- title: formatMessage(messages.backgroundColor),
192
- type: 'select',
193
- selectType: 'color',
194
- defaultValue: defaultPalette,
195
- options: panelBackgroundPalette,
196
- onChange: function onChange(option) {
197
- return changeColor(option.value);
198
- }
199
- };
200
- var emojiPicker = {
201
- id: 'editor.panel.emojiPicker',
202
- title: formatMessage(messages.emoji),
203
- type: 'select',
204
- selectType: 'emoji',
205
- options: [],
206
- selected: activePanelType === PanelType.CUSTOM && !!activePanelIcon,
207
- onChange: function onChange(emoji) {
208
- return changeEmoji(emoji);
209
- }
210
- };
211
- var removeEmojiButton = {
212
- id: 'editor.panel.removeEmoji',
213
- type: 'button',
214
- icon: RemoveEmojiIcon,
215
- onClick: removeEmoji(),
216
- title: formatMessage(commonMessages.removeEmoji),
217
- disabled: activePanelIcon ? false : true
218
- };
219
- items.push(emojiPicker, removeEmojiButton, {
220
- type: 'separator'
221
- }, colorPicker);
222
- }
223
- }
224
- if (state) {
225
- items.push({
226
- type: 'copy-button',
227
- items: [{
228
- type: 'separator'
229
- }, {
230
- state: state,
231
- formatMessage: formatMessage,
232
- nodeType: panelNodeType
233
- }]
234
- });
235
- }
236
- items.push({
237
- type: 'separator'
238
- }, {
239
- id: 'editor.panel.delete',
240
- type: 'button',
241
- appearance: 'danger',
242
- focusEditoronEnter: true,
243
- icon: RemoveIcon,
244
- onClick: removePanel(editorAnalyticsAPI),
245
- onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, true),
246
- onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, false),
247
- onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, true),
248
- onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, false),
249
- title: formatMessage(commonMessages.remove),
250
- tabIndex: null
251
- });
252
- return items;
253
- };
254
- export var getToolbarConfig = function getToolbarConfig(state, intl) {
255
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
256
- var providerFactory = arguments.length > 3 ? arguments[3] : undefined;
257
- var api = arguments.length > 4 ? arguments[4] : undefined;
258
- var formatMessage = intl.formatMessage;
259
- var panelObject = findPanel(state);
260
- if (panelObject) {
261
- var _api$analytics;
262
- var nodeType = state.schema.nodes.panel;
263
- var _panelObject$node$att = panelObject.node.attrs,
264
- panelType = _panelObject$node$att.panelType,
265
- panelColor = _panelObject$node$att.panelColor,
266
- panelIcon = _panelObject$node$att.panelIcon;
267
- var isStandardPanel = function isStandardPanel(panelType) {
268
- return panelType !== PanelType.CUSTOM ? panelType : undefined;
269
- };
270
-
271
- // force toolbar to be turned on
272
- var items = getToolbarItems(formatMessage, nodeType, options.allowCustomPanel || false, options.allowCustomPanel && options.allowCustomPanelEdit || false, providerFactory, api === null || api === void 0 ? void 0 : api.decorations.actions.hoverDecoration, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, panelType, options.allowCustomPanel ? panelColor : undefined, options.allowCustomPanel ? panelIcon || isStandardPanel(panelType) : undefined, state);
273
- var getDomRef = function getDomRef(editorView) {
274
- var domAtPos = editorView.domAtPos.bind(editorView);
275
- var element = findDomRefAtPos(panelObject.pos, domAtPos);
276
- return element;
277
- };
278
- return {
279
- title: 'Panel floating controls',
280
- getDomRef: getDomRef,
281
- nodeType: nodeType,
282
- items: items,
283
- scrollable: true
284
- };
285
- }
286
- return;
287
- };
@@ -1,2 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- export var pluginKey = new PluginKey('panelPlugin');
@@ -1,46 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- 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; }
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
- import { findSelectedNodeOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
- import { PanelType } from '@atlaskit/adf-schema';
6
- import { PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
7
- import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
8
- export var findPanel = function findPanel(state, selection) {
9
- var panel = state.schema.nodes.panel;
10
- return findSelectedNodeOfType(panel)(selection || state.selection) || findParentNodeOfType(panel)(selection || state.selection);
11
- };
12
- export var panelAttrsToDom = function panelAttrsToDom(attrs, allowCustomPanel) {
13
- var panelColor = attrs.panelColor,
14
- panelType = attrs.panelType,
15
- panelIcon = attrs.panelIcon,
16
- panelIconId = attrs.panelIconId,
17
- panelIconText = attrs.panelIconText;
18
- var isCustomPanel = panelType === PanelType.CUSTOM && allowCustomPanel;
19
- var hasIcon = !isCustomPanel || !!panelIcon || !!panelIconId;
20
- var tokenColor = panelColor && hexToEditorBackgroundPaletteColor(panelColor);
21
- var panelBackgroundColor = tokenColor || panelColor;
22
- var style = ["".concat(panelColor && isCustomPanel ? "background-color: ".concat(panelBackgroundColor, ";") : ''), "".concat(hasIcon ? '' : 'padding-left: 12px;')].join('');
23
- var panelAttrs = {
24
- class: PanelSharedCssClassName.prefix,
25
- 'data-panel-type': panelType || PanelType.INFO,
26
- style: style
27
- };
28
- if (panelColor && isCustomPanel) {
29
- panelAttrs = _objectSpread(_objectSpread({}, panelAttrs), {}, {
30
- 'data-panel-color': panelColor,
31
- 'data-panel-icon-id': panelIconId,
32
- 'data-panel-icon-text': panelIconText
33
- });
34
- }
35
- var iconDiv = ['div', {
36
- class: PanelSharedCssClassName.icon
37
- }];
38
- var contentDiv = ['div', {
39
- class: PanelSharedCssClassName.content
40
- }, 0];
41
- if (hasIcon) {
42
- return ['div', panelAttrs, iconDiv, contentDiv];
43
- } else {
44
- return ['div', panelAttrs, contentDiv];
45
- }
46
- };
@@ -1,12 +0,0 @@
1
- import { PanelType } from '@atlaskit/adf-schema';
2
- import type { Command } from '../../types';
3
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
- import type { PanelOptions } from './pm-plugins/main';
6
- export type DomAtPos = (pos: number) => {
7
- node: HTMLElement;
8
- offset: number;
9
- };
10
- export declare const removePanel: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
11
- export declare const changePanelType: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (panelType: PanelType, panelOptions?: PanelOptions, allowCustomPanel?: boolean) => Command;
12
- export declare function insertPanelWithAnalytics(inputMethod: INPUT_METHOD, analyticsAPI?: EditorAnalyticsAPI): import("@atlaskit/editor-common/types").Command;
@@ -1,17 +0,0 @@
1
- import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { PanelPluginOptions } from './types';
4
- import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
- export type PanelPlugin = NextEditorPlugin<'panel', {
7
- pluginConfiguration: PanelPluginOptions | undefined;
8
- dependencies: [
9
- typeof decorationsPlugin,
10
- OptionalPlugin<typeof analyticsPlugin>
11
- ];
12
- actions: {
13
- insertPanel: (inputMethod: INPUT_METHOD) => Command;
14
- };
15
- }>;
16
- declare const panelPlugin: PanelPlugin;
17
- export default panelPlugin;
@@ -1,37 +0,0 @@
1
- export declare const messages: {
2
- info: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
- note: {
8
- id: string;
9
- defaultMessage: string;
10
- description: string;
11
- };
12
- success: {
13
- id: string;
14
- defaultMessage: string;
15
- description: string;
16
- };
17
- warning: {
18
- id: string;
19
- defaultMessage: string;
20
- description: string;
21
- };
22
- error: {
23
- id: string;
24
- defaultMessage: string;
25
- description: string;
26
- };
27
- emoji: {
28
- id: string;
29
- defaultMessage: string;
30
- description: string;
31
- };
32
- backgroundColor: {
33
- id: string;
34
- defaultMessage: string;
35
- description: string;
36
- };
37
- };
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import type { Node } from '@atlaskit/editor-prosemirror/model';
3
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { PanelAttributes } from '@atlaskit/adf-schema';
5
- import { PanelType } from '@atlaskit/adf-schema';
6
- import type { getPosHandlerNode, getPosHandler } from '../../../nodeviews/';
7
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
8
- import type { PanelPluginOptions } from '../types';
9
- export declare const panelIcons: {
10
- [key in PanelType]: React.ComponentType<{
11
- label: string;
12
- }>;
13
- };
14
- interface PanelIconAttributes {
15
- panelAttributes: PanelAttributes;
16
- providerFactory?: ProviderFactory;
17
- allowCustomPanel?: boolean;
18
- }
19
- export declare const PanelIcon: React.FC<PanelIconAttributes>;
20
- declare class PanelNodeView {
21
- node: Node;
22
- dom: HTMLElement;
23
- contentDOM: HTMLElement;
24
- icon: HTMLElement;
25
- getPos: getPosHandlerNode;
26
- view: EditorView;
27
- providerFactory?: ProviderFactory;
28
- pluginOptions: PanelPluginOptions;
29
- constructor(node: Node, view: EditorView, getPos: getPosHandlerNode, pluginOptions: PanelPluginOptions, providerFactory?: ProviderFactory);
30
- ignoreMutation(mutation: MutationRecord | {
31
- type: 'selection';
32
- target: Element;
33
- }): boolean;
34
- }
35
- export declare const getPanelNodeView: (pluginOptions: PanelPluginOptions, providerFactory?: ProviderFactory) => (node: any, view: EditorView, getPos: getPosHandler) => PanelNodeView;
36
- export {};
@@ -1,3 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- export declare function keymapPlugin(): SafePlugin | undefined;
3
- export default keymapPlugin;
@@ -1,11 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
3
- import type { PanelPluginOptions } from '../types';
4
- import type { Dispatch } from '../../../event-dispatcher';
5
- export type PanelOptions = {
6
- color?: string;
7
- emoji?: string;
8
- emojiId?: string;
9
- emojiText?: string;
10
- };
11
- export declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, pluginOptions: PanelPluginOptions) => SafePlugin<any>;
@@ -1,16 +0,0 @@
1
- import type { FloatingToolbarConfig, FloatingToolbarItem, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { EmojiInfo, PanelPluginOptions } from './types';
3
- import type { IntlShape } from 'react-intl-next';
4
- import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
5
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
6
- import type { NodeType } from '@atlaskit/editor-prosemirror/model';
7
- import type { Command } from '../../types';
8
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
9
- import { PanelType } from '@atlaskit/adf-schema';
10
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
11
- import type { PanelPlugin } from './index';
12
- export declare const panelIconMap: {
13
- [key in Exclude<PanelType, PanelType.CUSTOM>]: EmojiInfo;
14
- };
15
- export declare const getToolbarItems: (formatMessage: IntlShape['formatMessage'], panelNodeType: NodeType, isCustomPanelEnabled: boolean, isCustomPanelEditable: boolean, providerFactory: ProviderFactory, hoverDecoration: HoverDecorationHandler | undefined, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, activePanelType?: string, activePanelColor?: string, activePanelIcon?: string, state?: EditorState) => FloatingToolbarItem<Command>[];
16
- export declare const getToolbarConfig: (state: EditorState, intl: IntlShape, options: PanelPluginOptions | undefined, providerFactory: ProviderFactory, api: ExtractInjectionAPI<PanelPlugin> | undefined) => FloatingToolbarConfig | undefined;
@@ -1,21 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
3
- export declare const pluginKey: PluginKey<any>;
4
- export interface PanelPluginOptions extends LongPressSelectionPluginOptions, PanelPluginConfig {
5
- }
6
- export interface PanelPluginConfig {
7
- allowCustomPanel?: boolean;
8
- allowCustomPanelEdit?: boolean;
9
- }
10
- export type DomPanelAtrrs = {
11
- class: string;
12
- 'data-panel-type': string;
13
- 'data-panel-color'?: string;
14
- 'data-panel-icon-id'?: string;
15
- 'data-panel-icon-text'?: string;
16
- style: string;
17
- };
18
- export type EmojiInfo = {
19
- shortName: string;
20
- id: string;
21
- };
@@ -1,5 +0,0 @@
1
- import type { DOMOutputSpec } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
3
- import type { PanelAttributes } from '@atlaskit/adf-schema';
4
- export declare const findPanel: (state: EditorState, selection?: Selection | null) => import("prosemirror-utils/dist/types").FindResult;
5
- export declare const panelAttrsToDom: (attrs: PanelAttributes, allowCustomPanel: boolean) => DOMOutputSpec;
@@ -1,12 +0,0 @@
1
- import { PanelType } from '@atlaskit/adf-schema';
2
- import type { Command } from '../../types';
3
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
- import type { PanelOptions } from './pm-plugins/main';
6
- export type DomAtPos = (pos: number) => {
7
- node: HTMLElement;
8
- offset: number;
9
- };
10
- export declare const removePanel: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
11
- export declare const changePanelType: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (panelType: PanelType, panelOptions?: PanelOptions, allowCustomPanel?: boolean) => Command;
12
- export declare function insertPanelWithAnalytics(inputMethod: INPUT_METHOD, analyticsAPI?: EditorAnalyticsAPI): import("@atlaskit/editor-common/types").Command;
@@ -1,17 +0,0 @@
1
- import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { PanelPluginOptions } from './types';
4
- import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
- export type PanelPlugin = NextEditorPlugin<'panel', {
7
- pluginConfiguration: PanelPluginOptions | undefined;
8
- dependencies: [
9
- typeof decorationsPlugin,
10
- OptionalPlugin<typeof analyticsPlugin>
11
- ];
12
- actions: {
13
- insertPanel: (inputMethod: INPUT_METHOD) => Command;
14
- };
15
- }>;
16
- declare const panelPlugin: PanelPlugin;
17
- export default panelPlugin;
@@ -1,37 +0,0 @@
1
- export declare const messages: {
2
- info: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
- note: {
8
- id: string;
9
- defaultMessage: string;
10
- description: string;
11
- };
12
- success: {
13
- id: string;
14
- defaultMessage: string;
15
- description: string;
16
- };
17
- warning: {
18
- id: string;
19
- defaultMessage: string;
20
- description: string;
21
- };
22
- error: {
23
- id: string;
24
- defaultMessage: string;
25
- description: string;
26
- };
27
- emoji: {
28
- id: string;
29
- defaultMessage: string;
30
- description: string;
31
- };
32
- backgroundColor: {
33
- id: string;
34
- defaultMessage: string;
35
- description: string;
36
- };
37
- };
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import type { Node } from '@atlaskit/editor-prosemirror/model';
3
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { PanelAttributes } from '@atlaskit/adf-schema';
5
- import { PanelType } from '@atlaskit/adf-schema';
6
- import type { getPosHandlerNode, getPosHandler } from '../../../nodeviews/';
7
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
8
- import type { PanelPluginOptions } from '../types';
9
- export declare const panelIcons: {
10
- [key in PanelType]: React.ComponentType<{
11
- label: string;
12
- }>;
13
- };
14
- interface PanelIconAttributes {
15
- panelAttributes: PanelAttributes;
16
- providerFactory?: ProviderFactory;
17
- allowCustomPanel?: boolean;
18
- }
19
- export declare const PanelIcon: React.FC<PanelIconAttributes>;
20
- declare class PanelNodeView {
21
- node: Node;
22
- dom: HTMLElement;
23
- contentDOM: HTMLElement;
24
- icon: HTMLElement;
25
- getPos: getPosHandlerNode;
26
- view: EditorView;
27
- providerFactory?: ProviderFactory;
28
- pluginOptions: PanelPluginOptions;
29
- constructor(node: Node, view: EditorView, getPos: getPosHandlerNode, pluginOptions: PanelPluginOptions, providerFactory?: ProviderFactory);
30
- ignoreMutation(mutation: MutationRecord | {
31
- type: 'selection';
32
- target: Element;
33
- }): boolean;
34
- }
35
- export declare const getPanelNodeView: (pluginOptions: PanelPluginOptions, providerFactory?: ProviderFactory) => (node: any, view: EditorView, getPos: getPosHandler) => PanelNodeView;
36
- export {};
@@ -1,3 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- export declare function keymapPlugin(): SafePlugin | undefined;
3
- export default keymapPlugin;
@@ -1,11 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
3
- import type { PanelPluginOptions } from '../types';
4
- import type { Dispatch } from '../../../event-dispatcher';
5
- export type PanelOptions = {
6
- color?: string;
7
- emoji?: string;
8
- emojiId?: string;
9
- emojiText?: string;
10
- };
11
- export declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, pluginOptions: PanelPluginOptions) => SafePlugin<any>;
@@ -1,16 +0,0 @@
1
- import type { FloatingToolbarConfig, FloatingToolbarItem, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { EmojiInfo, PanelPluginOptions } from './types';
3
- import type { IntlShape } from 'react-intl-next';
4
- import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
5
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
6
- import type { NodeType } from '@atlaskit/editor-prosemirror/model';
7
- import type { Command } from '../../types';
8
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
9
- import { PanelType } from '@atlaskit/adf-schema';
10
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
11
- import type { PanelPlugin } from './index';
12
- export declare const panelIconMap: {
13
- [key in Exclude<PanelType, PanelType.CUSTOM>]: EmojiInfo;
14
- };
15
- export declare const getToolbarItems: (formatMessage: IntlShape['formatMessage'], panelNodeType: NodeType, isCustomPanelEnabled: boolean, isCustomPanelEditable: boolean, providerFactory: ProviderFactory, hoverDecoration: HoverDecorationHandler | undefined, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, activePanelType?: string, activePanelColor?: string, activePanelIcon?: string, state?: EditorState) => FloatingToolbarItem<Command>[];
16
- export declare const getToolbarConfig: (state: EditorState, intl: IntlShape, options: PanelPluginOptions | undefined, providerFactory: ProviderFactory, api: ExtractInjectionAPI<PanelPlugin> | undefined) => FloatingToolbarConfig | undefined;