@atlaskit/editor-plugin-insert-block 1.13.0 → 1.14.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 (30) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/plugin.js +23 -3
  3. package/dist/cjs/ui/ElementBrowser/InsertMenu.js +47 -13
  4. package/dist/cjs/ui/ElementRail/index.js +186 -2
  5. package/dist/cjs/ui/ElementRail/useInsertMenuRailItems.js +63 -0
  6. package/dist/cjs/ui/templateOptions.js +128 -57
  7. package/dist/cjs/ui/templates.js +1130 -0
  8. package/dist/es2019/plugin.js +23 -3
  9. package/dist/es2019/ui/ElementBrowser/InsertMenu.js +61 -26
  10. package/dist/es2019/ui/ElementRail/index.js +189 -1
  11. package/dist/es2019/ui/ElementRail/useInsertMenuRailItems.js +54 -0
  12. package/dist/es2019/ui/templateOptions.js +78 -11
  13. package/dist/es2019/ui/templates.js +1118 -0
  14. package/dist/esm/plugin.js +23 -3
  15. package/dist/esm/ui/ElementBrowser/InsertMenu.js +47 -13
  16. package/dist/esm/ui/ElementRail/index.js +185 -2
  17. package/dist/esm/ui/ElementRail/useInsertMenuRailItems.js +56 -0
  18. package/dist/esm/ui/templateOptions.js +128 -57
  19. package/dist/esm/ui/templates.js +1124 -0
  20. package/dist/types/ui/ElementRail/index.d.ts +7 -4
  21. package/dist/types/ui/ElementRail/useInsertMenuRailItems.d.ts +4 -0
  22. package/dist/types/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
  23. package/dist/types/ui/templateOptions.d.ts +3 -1
  24. package/dist/types/ui/templates.d.ts +522 -0
  25. package/dist/types-ts4.5/ui/ElementRail/index.d.ts +7 -4
  26. package/dist/types-ts4.5/ui/ElementRail/useInsertMenuRailItems.d.ts +4 -0
  27. package/dist/types-ts4.5/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
  28. package/dist/types-ts4.5/ui/templateOptions.d.ts +3 -1
  29. package/dist/types-ts4.5/ui/templates.d.ts +522 -0
  30. package/package.json +6 -4
@@ -6,65 +6,136 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.templateOptions = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
+ var _analytics = require("@atlaskit/editor-common/analytics");
10
+ var _model = require("@atlaskit/editor-prosemirror/model");
9
11
  var _actionList = _interopRequireDefault(require("../assets/action-list"));
10
12
  var _approvalsTracker = _interopRequireDefault(require("../assets/approvals-tracker"));
11
13
  var _decisionMatrix = _interopRequireDefault(require("../assets/decision-matrix"));
12
14
  var _discussionNotes = _interopRequireDefault(require("../assets/discussion-notes"));
13
15
  var _instructionsOutline = _interopRequireDefault(require("../assets/instructions-outline"));
14
- var templateOptions = exports.templateOptions = [{
15
- title: 'Discussion notes',
16
- description: 'Record discussion points and action items',
17
- keywords: ['decisions', 'summary', 'meeting', 'chat', 'debrief', 'track', 'keep track', 'tasks', 'outstanding items', 'owners'],
18
- // Place templates right after AI item
19
- priority: 99,
20
- icon: function icon() {
21
- return /*#__PURE__*/_react.default.createElement(_discussionNotes.default, null);
22
- },
23
- action: function action() {
24
- return false;
25
- }
26
- }, {
27
- title: 'Approvals tracker',
28
- description: 'Track reviewer approvals and dates',
29
- keywords: ['reviews', 'requests', 'rejected requests', 'review dates', 'timeline', 'checklist', 'sme timeline', 'sme requests', 'sme check', 'table'],
30
- priority: 99,
31
- icon: function icon() {
32
- return /*#__PURE__*/_react.default.createElement(_approvalsTracker.default, null);
33
- },
34
- action: function action() {
35
- return false;
36
- }
37
- }, {
38
- title: 'Decision matrix',
39
- description: 'Compare options and make recommendations',
40
- keywords: ['pros', 'cons', 'recommended', 'rationale', 'evaluation', 'options', 'choice', 'table'],
41
- priority: 99,
42
- icon: function icon() {
43
- return /*#__PURE__*/_react.default.createElement(_decisionMatrix.default, null);
44
- },
45
- action: function action() {
46
- return false;
47
- }
48
- }, {
49
- title: 'List of actions',
50
- description: 'Track tasks, assignees and deadlines',
51
- keywords: ['checklist', 'check', 'items', 'shopping list', 'jtbd', 'jobs to be done', 'due date', 'progress', 'task', 'tasks', 'prioritization', 'timeline', 'approvals', 'reviewers', 'review date'],
52
- priority: 99,
53
- icon: function icon() {
54
- return /*#__PURE__*/_react.default.createElement(_actionList.default, null);
55
- },
56
- action: function action() {
57
- return false;
58
- }
59
- }, {
60
- title: 'Instructions outline',
61
- description: 'Detailed steps for any process',
62
- keywords: ['steps', 'manual', 'tasks', 'jobs to be done', 'jtbd', 'how-to', 'guide', 'journey', 'checklist', 'tutorial', 'map', 'brochure', 'columns', 'layout', 'help'],
63
- priority: 99,
64
- icon: function icon() {
65
- return /*#__PURE__*/_react.default.createElement(_instructionsOutline.default, null);
66
- },
67
- action: function action() {
68
- return false;
69
- }
70
- }];
16
+ var _templates = require("./templates");
17
+ var getTemplateInsertionPayload = function getTemplateInsertionPayload(templateType, source) {
18
+ return {
19
+ action: _analytics.ACTION.INSERTED,
20
+ actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
21
+ actionSubjectId: 'elementTemplate',
22
+ attributes: {
23
+ inputMethod: source !== null && source !== void 0 ? source : _analytics.INPUT_METHOD.QUICK_INSERT,
24
+ templateType: templateType
25
+ },
26
+ eventType: _analytics.EVENT_TYPE.TRACK
27
+ };
28
+ };
29
+ var getTableWidth = function getTableWidth(api) {
30
+ var _api$table;
31
+ return api !== null && api !== void 0 && (_api$table = api.table) !== null && _api$table !== void 0 && (_api$table = _api$table.sharedState.currentState()) !== null && _api$table !== void 0 && _api$table.isFullWidthModeEnabled ? 1800 : 760;
32
+ };
33
+ var templateOptions = exports.templateOptions = function templateOptions(api) {
34
+ return [{
35
+ title: 'Discussion notes',
36
+ // @ts-ignore
37
+ id: 'discussionNotes',
38
+ description: 'Record discussion points and action items',
39
+ keywords: ['decisions', 'summary', 'meeting', 'chat', 'debrief', 'track', 'keep track', 'tasks', 'outstanding items', 'owners'],
40
+ // Place templates right after AI item
41
+ priority: 99,
42
+ icon: function icon() {
43
+ return /*#__PURE__*/_react.default.createElement(_discussionNotes.default, null);
44
+ },
45
+ action: function action(insert, state, source) {
46
+ var _api$analytics;
47
+ var tr = insert(_model.Fragment.fromJSON(state.schema, (0, _templates.discussionNotes)(getTableWidth(api))), {
48
+ // @ts-ignore
49
+ isTemplate: true
50
+ });
51
+ api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent(
52
+ // @ts-ignore
53
+ getTemplateInsertionPayload('discussionNotes', source))(tr);
54
+ return tr;
55
+ }
56
+ }, {
57
+ title: 'Approvals tracker',
58
+ // @ts-ignore
59
+ id: 'approvalsTracker',
60
+ description: 'Track reviewer approvals and dates',
61
+ keywords: ['reviews', 'requests', 'rejected requests', 'review dates', 'timeline', 'checklist', 'sme timeline', 'sme requests', 'sme check', 'table'],
62
+ priority: 99,
63
+ icon: function icon() {
64
+ return /*#__PURE__*/_react.default.createElement(_approvalsTracker.default, null);
65
+ },
66
+ action: function action(insert, state, source) {
67
+ var _api$analytics2;
68
+ var tr = insert(_model.Fragment.fromJSON(state.schema, (0, _templates.approvalsTracker)(getTableWidth(api))), {
69
+ // @ts-ignore
70
+ isTemplate: true
71
+ });
72
+ api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent(
73
+ // @ts-ignore
74
+ getTemplateInsertionPayload('approvalsTracker', source))(tr);
75
+ return tr;
76
+ }
77
+ }, {
78
+ title: 'Decision matrix',
79
+ // @ts-ignore
80
+ id: 'decisionMatrix',
81
+ description: 'Compare options and make recommendations',
82
+ keywords: ['pros', 'cons', 'recommended', 'rationale', 'evaluation', 'options', 'choice', 'table'],
83
+ priority: 99,
84
+ icon: function icon() {
85
+ return /*#__PURE__*/_react.default.createElement(_decisionMatrix.default, null);
86
+ },
87
+ action: function action(insert, state, source) {
88
+ var _api$analytics3;
89
+ var tr = insert(_model.Fragment.fromJSON(state.schema, (0, _templates.decisionMatrix)(getTableWidth(api))), {
90
+ // @ts-ignore
91
+ isTemplate: true
92
+ });
93
+ api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || _api$analytics3.actions.attachAnalyticsEvent(
94
+ // @ts-ignore
95
+ getTemplateInsertionPayload('decisionMatrix', source))(tr);
96
+ return tr;
97
+ }
98
+ }, {
99
+ title: 'List of actions',
100
+ // @ts-ignore
101
+ id: 'actionList',
102
+ description: 'Track tasks, assignees and deadlines',
103
+ keywords: ['checklist', 'check', 'items', 'shopping list', 'jtbd', 'jobs to be done', 'due date', 'progress', 'task', 'tasks', 'prioritization', 'timeline', 'approvals', 'reviewers', 'review date'],
104
+ priority: 99,
105
+ icon: function icon() {
106
+ return /*#__PURE__*/_react.default.createElement(_actionList.default, null);
107
+ },
108
+ action: function action(insert, state, source) {
109
+ var _api$analytics4;
110
+ // @ts-ignore
111
+ var tr = insert(_model.Fragment.fromJSON(state.schema, _templates.actionList), {
112
+ isTemplate: true
113
+ });
114
+ api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || _api$analytics4.actions.attachAnalyticsEvent(
115
+ // @ts-ignore
116
+ getTemplateInsertionPayload('actionList', source))(tr);
117
+ return tr;
118
+ }
119
+ }, {
120
+ title: 'Instructions outline',
121
+ // @ts-ignore
122
+ id: 'instructionsOutline',
123
+ description: 'Detailed steps for any process',
124
+ keywords: ['steps', 'manual', 'tasks', 'jobs to be done', 'jtbd', 'how-to', 'guide', 'journey', 'checklist', 'tutorial', 'map', 'brochure', 'columns', 'layout', 'help'],
125
+ priority: 99,
126
+ icon: function icon() {
127
+ return /*#__PURE__*/_react.default.createElement(_instructionsOutline.default, null);
128
+ },
129
+ action: function action(insert, state, source) {
130
+ var _api$analytics5;
131
+ // @ts-ignore
132
+ var tr = insert(_model.Fragment.fromJSON(state.schema, _templates.instructionsOutline), {
133
+ isTemplate: true
134
+ });
135
+ api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 || _api$analytics5.actions.attachAnalyticsEvent(
136
+ // @ts-ignore
137
+ getTemplateInsertionPayload('instructionsOutline', source))(tr);
138
+ return tr;
139
+ }
140
+ }];
141
+ };