@atlaskit/editor-core 188.7.5 → 188.8.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.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/plugins/date/actions.js +8 -114
- package/dist/cjs/plugins/date/commands.js +118 -0
- package/dist/cjs/plugins/date/plugin.js +13 -7
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +34 -33
- package/dist/cjs/plugins/type-ahead/index.js +4 -372
- package/dist/cjs/plugins/type-ahead/plugin.js +382 -0
- package/dist/cjs/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +17 -8
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/date/actions.js +3 -109
- package/dist/es2019/plugins/date/commands.js +113 -0
- package/dist/es2019/plugins/date/plugin.js +14 -8
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +5 -3
- package/dist/es2019/plugins/type-ahead/index.js +2 -375
- package/dist/es2019/plugins/type-ahead/plugin.js +381 -0
- package/dist/es2019/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +17 -8
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/date/actions.js +8 -114
- package/dist/esm/plugins/date/commands.js +112 -0
- package/dist/esm/plugins/date/plugin.js +14 -8
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +34 -33
- package/dist/esm/plugins/type-ahead/index.js +2 -368
- package/dist/esm/plugins/type-ahead/plugin.js +374 -0
- package/dist/esm/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +17 -8
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +30 -12
- package/dist/types/plugins/date/actions.d.ts +4 -10
- package/dist/types/plugins/date/commands.d.ts +20 -0
- package/dist/types/plugins/date/types.d.ts +4 -4
- package/dist/types/plugins/type-ahead/index.d.ts +3 -14
- package/dist/types/plugins/type-ahead/plugin.d.ts +10 -0
- package/dist/types/plugins/type-ahead/types.d.ts +51 -6
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +30 -12
- package/dist/types-ts4.5/plugins/date/actions.d.ts +4 -10
- package/dist/types-ts4.5/plugins/date/commands.d.ts +22 -0
- package/dist/types-ts4.5/plugins/date/types.d.ts +4 -4
- package/dist/types-ts4.5/plugins/type-ahead/index.d.ts +3 -14
- package/dist/types-ts4.5/plugins/type-ahead/plugin.d.ts +10 -0
- package/dist/types-ts4.5/plugins/type-ahead/types.d.ts +53 -6
- package/package.json +2 -2
- package/dist/cjs/plugins/view-update-subscription/subscribe/type-ahead-updates.js +0 -33
- package/dist/es2019/plugins/view-update-subscription/subscribe/type-ahead-updates.js +0 -28
- package/dist/esm/plugins/view-update-subscription/subscribe/type-ahead-updates.js +0 -27
- package/dist/types/plugins/view-update-subscription/subscribe/type-ahead-updates.d.ts +0 -9
- package/dist/types-ts4.5/plugins/view-update-subscription/subscribe/type-ahead-updates.d.ts +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 188.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#41459](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41459) [`9874d0f70b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9874d0f70b0) - [ED-20003] TypeAhead extraction: Replace the mobile view-subscription with proper API
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 188.7.6
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#41438](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41438) [`b8d36b142ca`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b8d36b142ca) - Make insertDate and deleteDate an Editor Command
|
|
18
|
+
|
|
3
19
|
## 188.7.5
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.setDatePickerAt = exports.openDatePicker = exports.
|
|
6
|
+
exports.setDatePickerAt = exports.openDatePicker = exports.focusDateInput = exports.createDate = exports.closeDatePickerWithAnalytics = exports.closeDatePicker = void 0;
|
|
7
7
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
8
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
9
9
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
10
10
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
12
|
var _internal = require("./utils/internal");
|
|
13
|
-
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
14
13
|
var createDate = exports.createDate = function createDate(isQuickInsertAction) {
|
|
15
14
|
return function (insert, state) {
|
|
16
15
|
var dateNode = state.schema.nodes.date.createChecked({
|
|
@@ -31,25 +30,6 @@ var createDate = exports.createDate = function createDate(isQuickInsertAction) {
|
|
|
31
30
|
};
|
|
32
31
|
};
|
|
33
32
|
|
|
34
|
-
/** Delete the date and close the datepicker */
|
|
35
|
-
var deleteDate = exports.deleteDate = function deleteDate() {
|
|
36
|
-
return function (state, dispatch) {
|
|
37
|
-
var pluginState = _pluginKey.pluginKey.getState(state);
|
|
38
|
-
if (!pluginState || pluginState.showDatePickerAt === null) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
var showDatePickerAt = pluginState.showDatePickerAt;
|
|
42
|
-
var tr = state.tr.delete(showDatePickerAt, showDatePickerAt + 1).setMeta(_pluginKey.pluginKey, {
|
|
43
|
-
showDatePickerAt: null,
|
|
44
|
-
isNew: false
|
|
45
|
-
});
|
|
46
|
-
if (dispatch) {
|
|
47
|
-
dispatch(tr);
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
|
|
53
33
|
/** Focus input */
|
|
54
34
|
var focusDateInput = exports.focusDateInput = function focusDateInput() {
|
|
55
35
|
return function (state, dispatch) {
|
|
@@ -67,92 +47,6 @@ var focusDateInput = exports.focusDateInput = function focusDateInput() {
|
|
|
67
47
|
return true;
|
|
68
48
|
};
|
|
69
49
|
};
|
|
70
|
-
var insertDate = exports.insertDate = function insertDate(date, inputMethod, commitMethod) {
|
|
71
|
-
var enterPressed = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
72
|
-
var pluginInjectionApi = arguments.length > 4 ? arguments[4] : undefined;
|
|
73
|
-
return function (state, dispatch) {
|
|
74
|
-
var schema = state.schema;
|
|
75
|
-
var timestamp;
|
|
76
|
-
if (date) {
|
|
77
|
-
timestamp = Date.UTC(date.year, date.month - 1, date.day).toString();
|
|
78
|
-
} else {
|
|
79
|
-
timestamp = (0, _utils.todayTimestampInUTC)();
|
|
80
|
-
}
|
|
81
|
-
var tr = state.tr;
|
|
82
|
-
if (inputMethod) {
|
|
83
|
-
var _pluginInjectionApi$a;
|
|
84
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 || (_pluginInjectionApi$a = _pluginInjectionApi$a.actions) === null || _pluginInjectionApi$a === void 0 || _pluginInjectionApi$a.attachAnalyticsEvent({
|
|
85
|
-
action: _analytics.ACTION.INSERTED,
|
|
86
|
-
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
87
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.DATE,
|
|
88
|
-
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
89
|
-
attributes: {
|
|
90
|
-
inputMethod: inputMethod
|
|
91
|
-
}
|
|
92
|
-
})(tr);
|
|
93
|
-
}
|
|
94
|
-
if (commitMethod) {
|
|
95
|
-
var _pluginInjectionApi$a2;
|
|
96
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 || (_pluginInjectionApi$a2 = _pluginInjectionApi$a2.actions) === null || _pluginInjectionApi$a2 === void 0 || _pluginInjectionApi$a2.attachAnalyticsEvent({
|
|
97
|
-
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
98
|
-
action: _analytics.ACTION.COMMITTED,
|
|
99
|
-
actionSubject: _analytics.ACTION_SUBJECT.DATE,
|
|
100
|
-
attributes: {
|
|
101
|
-
commitMethod: commitMethod,
|
|
102
|
-
isValid: date !== undefined,
|
|
103
|
-
isToday: (0, _internal.isToday)(date)
|
|
104
|
-
}
|
|
105
|
-
})(tr);
|
|
106
|
-
}
|
|
107
|
-
var _ref = _pluginKey.pluginKey.getState(state) || {},
|
|
108
|
-
showDatePickerAt = _ref.showDatePickerAt;
|
|
109
|
-
if (!showDatePickerAt) {
|
|
110
|
-
var dateNode = schema.nodes.date.createChecked({
|
|
111
|
-
timestamp: timestamp
|
|
112
|
-
});
|
|
113
|
-
var textNode = state.schema.text(' ');
|
|
114
|
-
var fragment = _model.Fragment.fromArray([dateNode, textNode]);
|
|
115
|
-
var _state$selection = state.selection,
|
|
116
|
-
from = _state$selection.from,
|
|
117
|
-
to = _state$selection.to;
|
|
118
|
-
var insertable = (0, _utils2.canInsert)(tr.selection.$from, fragment);
|
|
119
|
-
if (!insertable) {
|
|
120
|
-
var parentSelection = _state.NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
|
|
121
|
-
tr.insert(parentSelection.to, fragment).setSelection(_state.NodeSelection.create(tr.doc, parentSelection.to + 1));
|
|
122
|
-
} else {
|
|
123
|
-
tr.replaceWith(from, to, fragment).setSelection(_state.NodeSelection.create(tr.doc, from));
|
|
124
|
-
}
|
|
125
|
-
if (dispatch) {
|
|
126
|
-
dispatch(tr.scrollIntoView().setMeta(_pluginKey.pluginKey, {
|
|
127
|
-
isNew: true
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
if (state.doc.nodeAt(showDatePickerAt)) {
|
|
133
|
-
if (enterPressed) {
|
|
134
|
-
// Setting selection to outside the date node causes showDatePickerAt
|
|
135
|
-
// to be set to null by the PM plugin (onSelectionChanged), which will
|
|
136
|
-
// immediately close the datepicker once a valid date is typed in.
|
|
137
|
-
// Adding this check forces it to stay open until the user presses Enter.
|
|
138
|
-
tr = tr.setSelection(_state.Selection.near(tr.doc.resolve(showDatePickerAt + 2)));
|
|
139
|
-
}
|
|
140
|
-
tr = tr.setNodeMarkup(showDatePickerAt, schema.nodes.date, {
|
|
141
|
-
timestamp: timestamp
|
|
142
|
-
}).setMeta(_pluginKey.pluginKey, {
|
|
143
|
-
isNew: false
|
|
144
|
-
}).scrollIntoView();
|
|
145
|
-
if (!enterPressed) {
|
|
146
|
-
tr = tr.setSelection(_state.NodeSelection.create(tr.doc, showDatePickerAt));
|
|
147
|
-
}
|
|
148
|
-
if (dispatch) {
|
|
149
|
-
dispatch(tr);
|
|
150
|
-
}
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
return false;
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
50
|
var setDatePickerAt = exports.setDatePickerAt = function setDatePickerAt(showDatePickerAt) {
|
|
157
51
|
return function (state, dispatch) {
|
|
158
52
|
dispatch(state.tr.setMeta(_pluginKey.pluginKey, {
|
|
@@ -163,8 +57,8 @@ var setDatePickerAt = exports.setDatePickerAt = function setDatePickerAt(showDat
|
|
|
163
57
|
};
|
|
164
58
|
var closeDatePicker = exports.closeDatePicker = function closeDatePicker() {
|
|
165
59
|
return function (state, dispatch) {
|
|
166
|
-
var
|
|
167
|
-
showDatePickerAt =
|
|
60
|
+
var _ref = _pluginKey.pluginKey.getState(state) || {},
|
|
61
|
+
showDatePickerAt = _ref.showDatePickerAt;
|
|
168
62
|
if (!dispatch) {
|
|
169
63
|
return false;
|
|
170
64
|
}
|
|
@@ -178,11 +72,11 @@ var closeDatePicker = exports.closeDatePicker = function closeDatePicker() {
|
|
|
178
72
|
return false;
|
|
179
73
|
};
|
|
180
74
|
};
|
|
181
|
-
var closeDatePickerWithAnalytics = exports.closeDatePickerWithAnalytics = function closeDatePickerWithAnalytics(
|
|
182
|
-
var _pluginInjectionApi$
|
|
183
|
-
var date =
|
|
184
|
-
pluginInjectionApi =
|
|
185
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
75
|
+
var closeDatePickerWithAnalytics = exports.closeDatePickerWithAnalytics = function closeDatePickerWithAnalytics(_ref2) {
|
|
76
|
+
var _pluginInjectionApi$a;
|
|
77
|
+
var date = _ref2.date,
|
|
78
|
+
pluginInjectionApi = _ref2.pluginInjectionApi;
|
|
79
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 || (_pluginInjectionApi$a = _pluginInjectionApi$a.actions) === null || _pluginInjectionApi$a === void 0 || _pluginInjectionApi$a.attachAnalyticsEvent({
|
|
186
80
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
187
81
|
action: _analytics.ACTION.COMMITTED,
|
|
188
82
|
actionSubject: _analytics.ACTION_SUBJECT.DATE,
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.insertDateCommand = exports.deleteDateCommand = void 0;
|
|
7
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
|
+
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
12
|
+
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
13
|
+
var _internal = require("./utils/internal");
|
|
14
|
+
/** Delete the date and close the datepicker */
|
|
15
|
+
var deleteDateCommand = exports.deleteDateCommand = function deleteDateCommand(pluginInjectionApi) {
|
|
16
|
+
return function (_ref) {
|
|
17
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
18
|
+
var tr = _ref.tr;
|
|
19
|
+
var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d2 = pluginInjectionApi.date) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.sharedState.currentState()) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
|
|
20
|
+
showDatePickerAt = _ref2.showDatePickerAt;
|
|
21
|
+
if (!showDatePickerAt) {
|
|
22
|
+
return tr;
|
|
23
|
+
}
|
|
24
|
+
tr.delete(showDatePickerAt, showDatePickerAt + 1).setMeta(_pluginKey.pluginKey, {
|
|
25
|
+
showDatePickerAt: null,
|
|
26
|
+
isNew: false
|
|
27
|
+
});
|
|
28
|
+
return tr;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
var insertDateCommand = exports.insertDateCommand = function insertDateCommand(pluginInjectionApi) {
|
|
32
|
+
return function (_ref3) {
|
|
33
|
+
var date = _ref3.date,
|
|
34
|
+
inputMethod = _ref3.inputMethod,
|
|
35
|
+
commitMethod = _ref3.commitMethod,
|
|
36
|
+
_ref3$enterPressed = _ref3.enterPressed,
|
|
37
|
+
enterPressed = _ref3$enterPressed === void 0 ? true : _ref3$enterPressed;
|
|
38
|
+
return function (_ref4) {
|
|
39
|
+
var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
40
|
+
var tr = _ref4.tr;
|
|
41
|
+
var schema = tr.doc.type.schema;
|
|
42
|
+
var timestamp;
|
|
43
|
+
if (date) {
|
|
44
|
+
timestamp = Date.UTC(date.year, date.month - 1, date.day).toString();
|
|
45
|
+
} else {
|
|
46
|
+
timestamp = (0, _utils2.todayTimestampInUTC)();
|
|
47
|
+
}
|
|
48
|
+
if (inputMethod) {
|
|
49
|
+
var _pluginInjectionApi$a;
|
|
50
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 || (_pluginInjectionApi$a = _pluginInjectionApi$a.actions) === null || _pluginInjectionApi$a === void 0 || _pluginInjectionApi$a.attachAnalyticsEvent({
|
|
51
|
+
action: _analytics.ACTION.INSERTED,
|
|
52
|
+
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
53
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.DATE,
|
|
54
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
55
|
+
attributes: {
|
|
56
|
+
inputMethod: inputMethod
|
|
57
|
+
}
|
|
58
|
+
})(tr);
|
|
59
|
+
}
|
|
60
|
+
if (commitMethod) {
|
|
61
|
+
var _pluginInjectionApi$a2;
|
|
62
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 || (_pluginInjectionApi$a2 = _pluginInjectionApi$a2.actions) === null || _pluginInjectionApi$a2 === void 0 || _pluginInjectionApi$a2.attachAnalyticsEvent({
|
|
63
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
64
|
+
action: _analytics.ACTION.COMMITTED,
|
|
65
|
+
actionSubject: _analytics.ACTION_SUBJECT.DATE,
|
|
66
|
+
attributes: {
|
|
67
|
+
commitMethod: commitMethod,
|
|
68
|
+
isValid: date !== undefined,
|
|
69
|
+
isToday: (0, _internal.isToday)(date)
|
|
70
|
+
}
|
|
71
|
+
})(tr);
|
|
72
|
+
}
|
|
73
|
+
var _ref5 = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d4 = pluginInjectionApi.date) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.sharedState.currentState()) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {},
|
|
74
|
+
showDatePickerAt = _ref5.showDatePickerAt;
|
|
75
|
+
if (!showDatePickerAt) {
|
|
76
|
+
var dateNode = schema.nodes.date.createChecked({
|
|
77
|
+
timestamp: timestamp
|
|
78
|
+
});
|
|
79
|
+
var textNode = schema.text(' ');
|
|
80
|
+
var fragment = _model.Fragment.fromArray([dateNode, textNode]);
|
|
81
|
+
var _tr$selection = tr.selection,
|
|
82
|
+
from = _tr$selection.from,
|
|
83
|
+
to = _tr$selection.to;
|
|
84
|
+
var insertable = (0, _utils.canInsert)(tr.selection.$from, fragment);
|
|
85
|
+
if (!insertable) {
|
|
86
|
+
var parentSelection = _state.NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
|
|
87
|
+
tr.insert(parentSelection.to, fragment).setSelection(_state.NodeSelection.create(tr.doc, parentSelection.to + 1));
|
|
88
|
+
} else {
|
|
89
|
+
tr.replaceWith(from, to, fragment).setSelection(_state.NodeSelection.create(tr.doc, from));
|
|
90
|
+
}
|
|
91
|
+
if (tr.docChanged) {
|
|
92
|
+
tr.scrollIntoView().setMeta(_pluginKey.pluginKey, {
|
|
93
|
+
isNew: true
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return tr;
|
|
97
|
+
}
|
|
98
|
+
if (tr.doc.nodeAt(showDatePickerAt)) {
|
|
99
|
+
if (enterPressed) {
|
|
100
|
+
// Setting selection to outside the date node causes showDatePickerAt
|
|
101
|
+
// to be set to null by the PM plugin (onSelectionChanged), which will
|
|
102
|
+
// immediately close the datepicker once a valid date is typed in.
|
|
103
|
+
// Adding this check forces it to stay open until the user presses Enter.
|
|
104
|
+
tr = tr.setSelection(_state.Selection.near(tr.doc.resolve(showDatePickerAt + 2)));
|
|
105
|
+
}
|
|
106
|
+
tr = tr.setNodeMarkup(showDatePickerAt, schema.nodes.date, {
|
|
107
|
+
timestamp: timestamp
|
|
108
|
+
}).setMeta(_pluginKey.pluginKey, {
|
|
109
|
+
isNew: false
|
|
110
|
+
}).scrollIntoView();
|
|
111
|
+
if (!enterPressed) {
|
|
112
|
+
tr = tr.setSelection(_state.NodeSelection.create(tr.doc, showDatePickerAt));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return tr;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
@@ -11,6 +11,7 @@ var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
|
11
11
|
var _reactLoadable = _interopRequireDefault(require("react-loadable"));
|
|
12
12
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
13
13
|
var _actions = require("./actions");
|
|
14
|
+
var _commands = require("./commands");
|
|
14
15
|
var _main = _interopRequireDefault(require("./pm-plugins/main"));
|
|
15
16
|
var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
|
16
17
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
@@ -61,20 +62,25 @@ function ContentComponent(_ref) {
|
|
|
61
62
|
isNew: isNew,
|
|
62
63
|
autoFocus: focusDateInput,
|
|
63
64
|
onDelete: function onDelete() {
|
|
64
|
-
(0,
|
|
65
|
+
dependencyApi === null || dependencyApi === void 0 || dependencyApi.core.actions.execute((0, _commands.deleteDateCommand)(dependencyApi));
|
|
65
66
|
editorView.focus();
|
|
66
|
-
return;
|
|
67
67
|
},
|
|
68
68
|
onSelect: function onSelect(date, commitMethod) {
|
|
69
69
|
// Undefined means couldn't parse date, null means invalid (out of bounds) date
|
|
70
70
|
if (date === undefined || date === null) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
(0,
|
|
73
|
+
dependencyApi === null || dependencyApi === void 0 || dependencyApi.core.actions.execute((0, _commands.insertDateCommand)(dependencyApi)({
|
|
74
|
+
date: date,
|
|
75
|
+
commitMethod: commitMethod
|
|
76
|
+
}));
|
|
74
77
|
editorView.focus();
|
|
75
78
|
},
|
|
76
79
|
onTextChanged: function onTextChanged(date) {
|
|
77
|
-
(0,
|
|
80
|
+
dependencyApi === null || dependencyApi === void 0 || dependencyApi.core.actions.execute((0, _commands.insertDateCommand)(dependencyApi)({
|
|
81
|
+
date: date,
|
|
82
|
+
enterPressed: false
|
|
83
|
+
}));
|
|
78
84
|
},
|
|
79
85
|
closeDatePicker: function closeDatePicker() {
|
|
80
86
|
(0, _actions.closeDatePicker)()(editorView.state, dispatch);
|
|
@@ -115,9 +121,9 @@ var datePlugin = function datePlugin(_ref3) {
|
|
|
115
121
|
focusDateInput: !!focusDateInput
|
|
116
122
|
};
|
|
117
123
|
},
|
|
118
|
-
|
|
119
|
-
insertDate:
|
|
120
|
-
deleteDate:
|
|
124
|
+
commands: {
|
|
125
|
+
insertDate: (0, _commands.insertDateCommand)(api),
|
|
126
|
+
deleteDate: (0, _commands.deleteDateCommand)(api)
|
|
121
127
|
},
|
|
122
128
|
nodes: function nodes() {
|
|
123
129
|
return [{
|
|
@@ -202,11 +202,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
202
202
|
})(state, dispatch)) !== null && _pluginInjectionApi$t !== void 0 ? _pluginInjectionApi$t : false;
|
|
203
203
|
});
|
|
204
204
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createDate", function (inputMethod) {
|
|
205
|
-
var _pluginInjectionApi$d
|
|
206
|
-
var
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
205
|
+
var _pluginInjectionApi$d;
|
|
206
|
+
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
207
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d = pluginInjectionApi.date) === null || _pluginInjectionApi$d === void 0 || (_pluginInjectionApi$d = _pluginInjectionApi$d.commands) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.insertDate({
|
|
208
|
+
inputMethod: inputMethod
|
|
209
|
+
}));
|
|
210
|
+
return true;
|
|
210
211
|
});
|
|
211
212
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createPlaceholderText", function () {
|
|
212
213
|
var editorView = _this.props.editorView;
|
|
@@ -220,15 +221,15 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
220
221
|
});
|
|
221
222
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createStatus", function (inputMethod) {
|
|
222
223
|
var _pluginInjectionApi$s, _pluginInjectionApi$s2;
|
|
223
|
-
var _this$
|
|
224
|
-
pluginInjectionApi = _this$
|
|
225
|
-
editorView = _this$
|
|
224
|
+
var _this$props3 = _this.props,
|
|
225
|
+
pluginInjectionApi = _this$props3.pluginInjectionApi,
|
|
226
|
+
editorView = _this$props3.editorView;
|
|
226
227
|
return (_pluginInjectionApi$s = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s2 = pluginInjectionApi.status) === null || _pluginInjectionApi$s2 === void 0 || (_pluginInjectionApi$s2 = _pluginInjectionApi$s2.actions) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : _pluginInjectionApi$s2.updateStatus(inputMethod)(editorView.state, editorView.dispatch)) !== null && _pluginInjectionApi$s !== void 0 ? _pluginInjectionApi$s : false;
|
|
227
228
|
});
|
|
228
229
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openMediaPicker", function (inputMethod) {
|
|
229
|
-
var _this$
|
|
230
|
-
onShowMediaPicker = _this$
|
|
231
|
-
dispatchAnalyticsEvent = _this$
|
|
230
|
+
var _this$props4 = _this.props,
|
|
231
|
+
onShowMediaPicker = _this$props4.onShowMediaPicker,
|
|
232
|
+
dispatchAnalyticsEvent = _this$props4.dispatchAnalyticsEvent;
|
|
232
233
|
if (onShowMediaPicker) {
|
|
233
234
|
onShowMediaPicker();
|
|
234
235
|
if (dispatchAnalyticsEvent) {
|
|
@@ -256,11 +257,11 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
256
257
|
});
|
|
257
258
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertHorizontalRule", function (inputMethod) {
|
|
258
259
|
var _pluginInjectionApi$r, _pluginInjectionApi$r2;
|
|
259
|
-
var _this$
|
|
260
|
-
_this$
|
|
261
|
-
state = _this$
|
|
262
|
-
dispatch = _this$
|
|
263
|
-
pluginInjectionApi = _this$
|
|
260
|
+
var _this$props5 = _this.props,
|
|
261
|
+
_this$props5$editorVi = _this$props5.editorView,
|
|
262
|
+
state = _this$props5$editorVi.state,
|
|
263
|
+
dispatch = _this$props5$editorVi.dispatch,
|
|
264
|
+
pluginInjectionApi = _this$props5.pluginInjectionApi;
|
|
264
265
|
return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$r2 = pluginInjectionApi.rule) === null || _pluginInjectionApi$r2 === void 0 ? void 0 : _pluginInjectionApi$r2.actions.insertHorizontalRule(inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$r !== void 0 ? _pluginInjectionApi$r : false;
|
|
265
266
|
});
|
|
266
267
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertExpand", function () {
|
|
@@ -271,9 +272,9 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
271
272
|
});
|
|
272
273
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertBlockType", function (itemName) {
|
|
273
274
|
return function () {
|
|
274
|
-
var _this$
|
|
275
|
-
editorView = _this$
|
|
276
|
-
onInsertBlockType = _this$
|
|
275
|
+
var _this$props6 = _this.props,
|
|
276
|
+
editorView = _this$props6.editorView,
|
|
277
|
+
onInsertBlockType = _this$props6.onInsertBlockType;
|
|
277
278
|
var state = editorView.state,
|
|
278
279
|
dispatch = editorView.dispatch;
|
|
279
280
|
onInsertBlockType(itemName)(state, dispatch);
|
|
@@ -296,11 +297,11 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
296
297
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onItemActivated", function (_ref2) {
|
|
297
298
|
var item = _ref2.item,
|
|
298
299
|
inputMethod = _ref2.inputMethod;
|
|
299
|
-
var _this$
|
|
300
|
-
editorView = _this$
|
|
301
|
-
editorActions = _this$
|
|
302
|
-
handleImageUpload = _this$
|
|
303
|
-
expandEnabled = _this$
|
|
300
|
+
var _this$props7 = _this.props,
|
|
301
|
+
editorView = _this$props7.editorView,
|
|
302
|
+
editorActions = _this$props7.editorActions,
|
|
303
|
+
handleImageUpload = _this$props7.handleImageUpload,
|
|
304
|
+
expandEnabled = _this$props7.expandEnabled;
|
|
304
305
|
|
|
305
306
|
// need to do this before inserting nodes so scrollIntoView works properly
|
|
306
307
|
if (!editorView.hasFocus()) {
|
|
@@ -416,12 +417,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
416
417
|
key: "renderPopup",
|
|
417
418
|
value: function renderPopup() {
|
|
418
419
|
var emojiPickerOpen = this.state.emojiPickerOpen;
|
|
419
|
-
var _this$
|
|
420
|
-
popupsMountPoint = _this$
|
|
421
|
-
popupsBoundariesElement = _this$
|
|
422
|
-
popupsScrollableElement = _this$
|
|
423
|
-
emojiProvider = _this$
|
|
424
|
-
replacePlusMenuWithElementBrowser = _this$
|
|
420
|
+
var _this$props8 = this.props,
|
|
421
|
+
popupsMountPoint = _this$props8.popupsMountPoint,
|
|
422
|
+
popupsBoundariesElement = _this$props8.popupsBoundariesElement,
|
|
423
|
+
popupsScrollableElement = _this$props8.popupsScrollableElement,
|
|
424
|
+
emojiProvider = _this$props8.emojiProvider,
|
|
425
|
+
replacePlusMenuWithElementBrowser = _this$props8.replacePlusMenuWithElementBrowser;
|
|
425
426
|
var dropdownEmoji = this.state.dropdownItems.some(function (_ref4) {
|
|
426
427
|
var name = _ref4.value.name;
|
|
427
428
|
return name === 'emoji';
|
|
@@ -458,9 +459,9 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
458
459
|
buttons = _this$state.buttons,
|
|
459
460
|
dropdownItems = _this$state.dropdownItems,
|
|
460
461
|
emojiPickerOpen = _this$state.emojiPickerOpen;
|
|
461
|
-
var _this$
|
|
462
|
-
isDisabled = _this$
|
|
463
|
-
isReducedSpacing = _this$
|
|
462
|
+
var _this$props9 = this.props,
|
|
463
|
+
isDisabled = _this$props9.isDisabled,
|
|
464
|
+
isReducedSpacing = _this$props9.isReducedSpacing;
|
|
464
465
|
if (buttons.length === 0 && dropdownItems.length === 0) {
|
|
465
466
|
return null;
|
|
466
467
|
}
|