@atlaskit/editor-plugin-insert-block 0.2.4 → 0.2.5

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,11 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 0.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#60612](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/60612) [`7edc766361a2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7edc766361a2) - Created an EditorCommad on table plugin to insert a table of custom size
8
+
3
9
  ## 0.2.4
4
10
 
5
11
  ### Patch Changes
@@ -199,6 +199,13 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
199
199
  eventType: _analytics.EVENT_TYPE.TRACK
200
200
  })(state, dispatch)) !== null && _pluginInjectionApi$t !== void 0 ? _pluginInjectionApi$t : false;
201
201
  });
202
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertTableWithSize", function (inputMethod, rowsCount, colsCount) {
203
+ return function () {
204
+ var _pluginInjectionApi$t5;
205
+ var pluginInjectionApi = _this.props.pluginInjectionApi;
206
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t5 = pluginInjectionApi.table) === null || _pluginInjectionApi$t5 === void 0 ? void 0 : _pluginInjectionApi$t5.commands.insertTableWithSize(rowsCount, colsCount, _analytics.INPUT_METHOD.PICKER));
207
+ };
208
+ });
202
209
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createDate", function (inputMethod) {
203
210
  var _pluginInjectionApi$d;
204
211
  var pluginInjectionApi = _this.props.pluginInjectionApi;
@@ -252,14 +259,14 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
252
259
  });
253
260
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertTaskDecision", function (name, inputMethod) {
254
261
  return function () {
255
- var _pluginInjectionApi$t5, _pluginInjectionApi$t6;
262
+ var _pluginInjectionApi$t6, _pluginInjectionApi$t7;
256
263
  var _this$props7 = _this.props,
257
264
  _this$props7$editorVi = _this$props7.editorView,
258
265
  state = _this$props7$editorVi.state,
259
266
  dispatch = _this$props7$editorVi.dispatch,
260
267
  pluginInjectionApi = _this$props7.pluginInjectionApi;
261
268
  var listType = name === 'action' ? 'taskList' : 'decisionList';
262
- return (_pluginInjectionApi$t5 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t6 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t6 === void 0 ? void 0 : _pluginInjectionApi$t6.actions.insertTaskDecision(listType, inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$t5 !== void 0 ? _pluginInjectionApi$t5 : false;
269
+ return (_pluginInjectionApi$t6 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t7 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t7 === void 0 ? void 0 : _pluginInjectionApi$t7.actions.insertTaskDecision(listType, inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$t6 !== void 0 ? _pluginInjectionApi$t6 : false;
263
270
  };
264
271
  });
265
272
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertHorizontalRule", function (inputMethod) {
@@ -324,6 +331,9 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
324
331
  case 'table':
325
332
  _this.insertTable(inputMethod);
326
333
  break;
334
+ case 'table with size':
335
+ _this.insertTableWithSize(inputMethod, 3, 3)(); // adding command here to pass typecheck but will implement the actual feature in future ticket
336
+ break;
327
337
  case 'image upload':
328
338
  if (handleImageUpload) {
329
339
  var state = editorView.state,
@@ -4,12 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.table = exports.status = exports.placeholder = exports.panel = exports.more = exports.mention = exports.media = exports.link = exports.layout = exports.imageUpload = exports.horizontalrule = exports.expand = exports.emoji = exports.decision = exports.date = exports.codeblock = exports.blockquote = exports.action = void 0;
7
+ exports.tablePicker = exports.table = exports.status = exports.placeholder = exports.panel = exports.more = exports.mention = exports.media = exports.link = exports.layout = exports.imageUpload = exports.horizontalrule = exports.expand = exports.emoji = exports.decision = exports.date = exports.codeblock = exports.blockquote = exports.action = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _react2 = require("@emotion/react");
10
10
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
11
11
  var _keymaps = require("@atlaskit/editor-common/keymaps");
12
12
  var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
13
+ var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
13
14
  var _chevronRightCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-right-circle"));
14
15
  var _code = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/code"));
15
16
  var _date = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/date"));
@@ -131,6 +132,17 @@ var table = exports.table = mem(function (init) {
131
132
  'aria-keyshortcuts': (0, _keymaps.getAriaKeyshortcuts)(_keymaps.toggleTable)
132
133
  });
133
134
  });
135
+
136
+ //SIMONE TODO:
137
+ var tablePicker = exports.tablePicker = mem(function (init) {
138
+ return from({
139
+ content: init.content,
140
+ tooltipDescription: init.tooltipDescription,
141
+ disabled: init.disabled,
142
+ name: 'table picker',
143
+ Icon: _chevronDown.default
144
+ });
145
+ });
134
146
  var layout = exports.layout = mem(function (init) {
135
147
  return from({
136
148
  content: init.content,
@@ -185,6 +185,13 @@ export class ToolbarInsertBlock extends React.PureComponent {
185
185
  eventType: EVENT_TYPE.TRACK
186
186
  })(state, dispatch)) !== null && _pluginInjectionApi$t !== void 0 ? _pluginInjectionApi$t : false;
187
187
  });
188
+ _defineProperty(this, "insertTableWithSize", (inputMethod, rowsCount, colsCount) => () => {
189
+ var _pluginInjectionApi$t5;
190
+ const {
191
+ pluginInjectionApi
192
+ } = this.props;
193
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$t5 = pluginInjectionApi.table) === null || _pluginInjectionApi$t5 === void 0 ? void 0 : _pluginInjectionApi$t5.commands.insertTableWithSize(rowsCount, colsCount, INPUT_METHOD.PICKER));
194
+ });
188
195
  _defineProperty(this, "createDate", inputMethod => {
189
196
  var _pluginInjectionApi$d, _pluginInjectionApi$d2;
190
197
  const {
@@ -243,7 +250,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
243
250
  return true;
244
251
  });
245
252
  _defineProperty(this, "insertTaskDecision", (name, inputMethod) => () => {
246
- var _pluginInjectionApi$t5, _pluginInjectionApi$t6;
253
+ var _pluginInjectionApi$t6, _pluginInjectionApi$t7;
247
254
  const {
248
255
  editorView: {
249
256
  state,
@@ -252,7 +259,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
252
259
  pluginInjectionApi
253
260
  } = this.props;
254
261
  const listType = name === 'action' ? 'taskList' : 'decisionList';
255
- return (_pluginInjectionApi$t5 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$t6 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t6 === void 0 ? void 0 : _pluginInjectionApi$t6.actions.insertTaskDecision(listType, inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$t5 !== void 0 ? _pluginInjectionApi$t5 : false;
262
+ return (_pluginInjectionApi$t6 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$t7 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t7 === void 0 ? void 0 : _pluginInjectionApi$t7.actions.insertTaskDecision(listType, inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$t6 !== void 0 ? _pluginInjectionApi$t6 : false;
256
263
  });
257
264
  _defineProperty(this, "insertHorizontalRule", inputMethod => {
258
265
  var _pluginInjectionApi$r, _pluginInjectionApi$r2;
@@ -327,6 +334,9 @@ export class ToolbarInsertBlock extends React.PureComponent {
327
334
  case 'table':
328
335
  this.insertTable(inputMethod);
329
336
  break;
337
+ case 'table with size':
338
+ this.insertTableWithSize(inputMethod, 3, 3)(); // adding command here to pass typecheck but will implement the actual feature in future ticket
339
+ break;
330
340
  case 'image upload':
331
341
  if (handleImageUpload) {
332
342
  const {
@@ -4,6 +4,7 @@ import { jsx } from '@emotion/react';
4
4
  import memoizeOne from 'memoize-one';
5
5
  import { addLink, getAriaKeyshortcuts, toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
6
6
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
7
+ import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
7
8
  import ExpandNodeIcon from '@atlaskit/icon/glyph/chevron-right-circle';
8
9
  import CodeIcon from '@atlaskit/icon/glyph/editor/code';
9
10
  import DateIcon from '@atlaskit/icon/glyph/editor/date';
@@ -107,6 +108,15 @@ export const table = mem(init => from({
107
108
  shortcut: tooltip(toggleTable),
108
109
  'aria-keyshortcuts': getAriaKeyshortcuts(toggleTable)
109
110
  }));
111
+
112
+ //SIMONE TODO:
113
+ export const tablePicker = mem(init => from({
114
+ content: init.content,
115
+ tooltipDescription: init.tooltipDescription,
116
+ disabled: init.disabled,
117
+ name: 'table picker',
118
+ Icon: ExpandIcon
119
+ }));
110
120
  export const layout = mem(init => from({
111
121
  content: init.content,
112
122
  tooltipDescription: init.tooltipDescription,
@@ -193,6 +193,13 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
193
193
  eventType: EVENT_TYPE.TRACK
194
194
  })(state, dispatch)) !== null && _pluginInjectionApi$t !== void 0 ? _pluginInjectionApi$t : false;
195
195
  });
196
+ _defineProperty(_assertThisInitialized(_this), "insertTableWithSize", function (inputMethod, rowsCount, colsCount) {
197
+ return function () {
198
+ var _pluginInjectionApi$t5;
199
+ var pluginInjectionApi = _this.props.pluginInjectionApi;
200
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t5 = pluginInjectionApi.table) === null || _pluginInjectionApi$t5 === void 0 ? void 0 : _pluginInjectionApi$t5.commands.insertTableWithSize(rowsCount, colsCount, INPUT_METHOD.PICKER));
201
+ };
202
+ });
196
203
  _defineProperty(_assertThisInitialized(_this), "createDate", function (inputMethod) {
197
204
  var _pluginInjectionApi$d;
198
205
  var pluginInjectionApi = _this.props.pluginInjectionApi;
@@ -246,14 +253,14 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
246
253
  });
247
254
  _defineProperty(_assertThisInitialized(_this), "insertTaskDecision", function (name, inputMethod) {
248
255
  return function () {
249
- var _pluginInjectionApi$t5, _pluginInjectionApi$t6;
256
+ var _pluginInjectionApi$t6, _pluginInjectionApi$t7;
250
257
  var _this$props7 = _this.props,
251
258
  _this$props7$editorVi = _this$props7.editorView,
252
259
  state = _this$props7$editorVi.state,
253
260
  dispatch = _this$props7$editorVi.dispatch,
254
261
  pluginInjectionApi = _this$props7.pluginInjectionApi;
255
262
  var listType = name === 'action' ? 'taskList' : 'decisionList';
256
- return (_pluginInjectionApi$t5 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t6 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t6 === void 0 ? void 0 : _pluginInjectionApi$t6.actions.insertTaskDecision(listType, inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$t5 !== void 0 ? _pluginInjectionApi$t5 : false;
263
+ return (_pluginInjectionApi$t6 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t7 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t7 === void 0 ? void 0 : _pluginInjectionApi$t7.actions.insertTaskDecision(listType, inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$t6 !== void 0 ? _pluginInjectionApi$t6 : false;
257
264
  };
258
265
  });
259
266
  _defineProperty(_assertThisInitialized(_this), "insertHorizontalRule", function (inputMethod) {
@@ -318,6 +325,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
318
325
  case 'table':
319
326
  _this.insertTable(inputMethod);
320
327
  break;
328
+ case 'table with size':
329
+ _this.insertTableWithSize(inputMethod, 3, 3)(); // adding command here to pass typecheck but will implement the actual feature in future ticket
330
+ break;
321
331
  case 'image upload':
322
332
  if (handleImageUpload) {
323
333
  var state = editorView.state,
@@ -4,6 +4,7 @@ import { jsx } from '@emotion/react';
4
4
  import memoizeOne from 'memoize-one';
5
5
  import { addLink, getAriaKeyshortcuts, toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
6
6
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
7
+ import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
7
8
  import ExpandNodeIcon from '@atlaskit/icon/glyph/chevron-right-circle';
8
9
  import CodeIcon from '@atlaskit/icon/glyph/editor/code';
9
10
  import DateIcon from '@atlaskit/icon/glyph/editor/date';
@@ -123,6 +124,17 @@ export var table = mem(function (init) {
123
124
  'aria-keyshortcuts': getAriaKeyshortcuts(toggleTable)
124
125
  });
125
126
  });
127
+
128
+ //SIMONE TODO:
129
+ export var tablePicker = mem(function (init) {
130
+ return from({
131
+ content: init.content,
132
+ tooltipDescription: init.tooltipDescription,
133
+ disabled: init.disabled,
134
+ name: 'table picker',
135
+ Icon: ExpandIcon
136
+ });
137
+ });
126
138
  export var layout = mem(function (init) {
127
139
  return from({
128
140
  content: init.content,
@@ -25,6 +25,7 @@ export declare class ToolbarInsertBlock extends React.PureComponent<Props & Wrap
25
25
  private toggleLinkPanel;
26
26
  private insertMention;
27
27
  private insertTable;
28
+ private insertTableWithSize;
28
29
  private createDate;
29
30
  private createPlaceholderText;
30
31
  private insertLayoutColumns;
@@ -16,6 +16,7 @@ export declare const imageUpload: MemoizedFn<(init: CreateInit) => MenuItem>;
16
16
  export declare const mention: MemoizedFn<(init: CreateInit) => MenuItem>;
17
17
  export declare const emoji: MemoizedFn<(init: CreateInit) => MenuItem>;
18
18
  export declare const table: MemoizedFn<(init: CreateInit) => MenuItem>;
19
+ export declare const tablePicker: MemoizedFn<(init: CreateInit) => MenuItem>;
19
20
  export declare const layout: MemoizedFn<(init: CreateInit) => MenuItem>;
20
21
  export declare const codeblock: MemoizedFn<(init: CreateInit & {
21
22
  shortcut?: string;
@@ -25,6 +25,7 @@ export declare class ToolbarInsertBlock extends React.PureComponent<Props & Wrap
25
25
  private toggleLinkPanel;
26
26
  private insertMention;
27
27
  private insertTable;
28
+ private insertTableWithSize;
28
29
  private createDate;
29
30
  private createPlaceholderText;
30
31
  private insertLayoutColumns;
@@ -16,6 +16,7 @@ export declare const imageUpload: MemoizedFn<(init: CreateInit) => MenuItem>;
16
16
  export declare const mention: MemoizedFn<(init: CreateInit) => MenuItem>;
17
17
  export declare const emoji: MemoizedFn<(init: CreateInit) => MenuItem>;
18
18
  export declare const table: MemoizedFn<(init: CreateInit) => MenuItem>;
19
+ export declare const tablePicker: MemoizedFn<(init: CreateInit) => MenuItem>;
19
20
  export declare const layout: MemoizedFn<(init: CreateInit) => MenuItem>;
20
21
  export declare const codeblock: MemoizedFn<(init: CreateInit & {
21
22
  shortcut?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -50,7 +50,7 @@
50
50
  "@atlaskit/editor-plugin-quick-insert": "^0.2.0",
51
51
  "@atlaskit/editor-plugin-rule": "^0.1.0",
52
52
  "@atlaskit/editor-plugin-status": "^0.2.0",
53
- "@atlaskit/editor-plugin-table": "^5.4.0",
53
+ "@atlaskit/editor-plugin-table": "^5.5.0",
54
54
  "@atlaskit/editor-plugin-tasks-and-decisions": "^0.2.0",
55
55
  "@atlaskit/editor-plugin-type-ahead": "^0.8.0",
56
56
  "@atlaskit/editor-prosemirror": "1.1.0",
@@ -58,7 +58,7 @@
58
58
  "@atlaskit/emoji": "^67.6.0",
59
59
  "@atlaskit/icon": "^22.0.0",
60
60
  "@atlaskit/theme": "^12.6.0",
61
- "@atlaskit/tokens": "^1.29.0",
61
+ "@atlaskit/tokens": "^1.30.0",
62
62
  "@babel/runtime": "^7.0.0",
63
63
  "@emotion/react": "^11.7.1",
64
64
  "lodash": "^4.17.21",