@atlaskit/editor-core 189.3.29 → 189.3.31
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 +13 -0
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/presets/universal.js +2 -1
- package/dist/cjs/utils/document.js +0 -6
- package/dist/cjs/utils/index.js +0 -6
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/presets/universal.js +2 -1
- package/dist/es2019/utils/document.js +1 -1
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/presets/universal.js +2 -1
- package/dist/esm/utils/document.js +1 -1
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/insert-block/types.d.ts +2 -2
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +2 -2
- package/dist/types/utils/document.d.ts +1 -1
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +2 -2
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/document.d.ts +1 -1
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/package.json +4 -4
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +0 -288
- package/dist/cjs/plugins/tasks-and-decisions/index.js +0 -166
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +0 -117
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/hooks/use-show-placeholder.js +0 -40
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +0 -211
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/commands.js +0 -96
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/helpers.js +0 -299
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/input-rules.js +0 -94
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +0 -376
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +0 -263
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/plugin-key.js +0 -8
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/types.js +0 -11
- package/dist/cjs/plugins/tasks-and-decisions/types.js +0 -5
- package/dist/cjs/plugins/tasks-and-decisions/ui/Decision/index.js +0 -51
- package/dist/cjs/plugins/tasks-and-decisions/ui/Task/index.js +0 -80
- package/dist/cjs/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.js +0 -137
- package/dist/cjs/plugins/tasks-and-decisions/ui/ToolbarDecision/index.js +0 -76
- package/dist/cjs/plugins/tasks-and-decisions/ui/ToolbarTask/index.js +0 -75
- package/dist/cjs/plugins/tasks-and-decisions/utils.js +0 -41
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +0 -279
- package/dist/es2019/plugins/tasks-and-decisions/index.js +0 -155
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +0 -76
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/hooks/use-show-placeholder.js +0 -36
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +0 -173
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/commands.js +0 -94
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/helpers.js +0 -316
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/input-rules.js +0 -91
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +0 -370
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +0 -262
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/plugin-key.js +0 -2
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/types.js +0 -5
- package/dist/es2019/plugins/tasks-and-decisions/types.js +0 -1
- package/dist/es2019/plugins/tasks-and-decisions/ui/Decision/index.js +0 -30
- package/dist/es2019/plugins/tasks-and-decisions/ui/Task/index.js +0 -54
- package/dist/es2019/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.js +0 -71
- package/dist/es2019/plugins/tasks-and-decisions/ui/ToolbarDecision/index.js +0 -52
- package/dist/es2019/plugins/tasks-and-decisions/ui/ToolbarTask/index.js +0 -51
- package/dist/es2019/plugins/tasks-and-decisions/utils.js +0 -32
- package/dist/esm/plugins/tasks-and-decisions/commands.js +0 -281
- package/dist/esm/plugins/tasks-and-decisions/index.js +0 -156
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +0 -110
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/hooks/use-show-placeholder.js +0 -34
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +0 -204
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/commands.js +0 -90
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/helpers.js +0 -285
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/input-rules.js +0 -87
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +0 -368
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +0 -256
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/plugin-key.js +0 -2
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/types.js +0 -5
- package/dist/esm/plugins/tasks-and-decisions/types.js +0 -1
- package/dist/esm/plugins/tasks-and-decisions/ui/Decision/index.js +0 -44
- package/dist/esm/plugins/tasks-and-decisions/ui/Task/index.js +0 -70
- package/dist/esm/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.js +0 -128
- package/dist/esm/plugins/tasks-and-decisions/ui/ToolbarDecision/index.js +0 -66
- package/dist/esm/plugins/tasks-and-decisions/ui/ToolbarTask/index.js +0 -65
- package/dist/esm/plugins/tasks-and-decisions/utils.js +0 -30
- package/dist/types/plugins/tasks-and-decisions/commands.d.ts +0 -16
- package/dist/types/plugins/tasks-and-decisions/index.d.ts +0 -3
- package/dist/types/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +0 -10
- package/dist/types/plugins/tasks-and-decisions/nodeviews/hooks/use-show-placeholder.d.ts +0 -11
- package/dist/types/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +0 -14
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/commands.d.ts +0 -15
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/helpers.d.ts +0 -76
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/input-rules.d.ts +0 -6
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +0 -11
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/main.d.ts +0 -7
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/plugin-key.d.ts +0 -2
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/types.d.ts +0 -8
- package/dist/types/plugins/tasks-and-decisions/types.d.ts +0 -49
- package/dist/types/plugins/tasks-and-decisions/ui/Decision/index.d.ts +0 -14
- package/dist/types/plugins/tasks-and-decisions/ui/Task/index.d.ts +0 -28
- package/dist/types/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.d.ts +0 -29
- package/dist/types/plugins/tasks-and-decisions/ui/ToolbarDecision/index.d.ts +0 -23
- package/dist/types/plugins/tasks-and-decisions/ui/ToolbarTask/index.d.ts +0 -23
- package/dist/types/plugins/tasks-and-decisions/utils.d.ts +0 -4
- package/dist/types-ts4.5/plugins/tasks-and-decisions/commands.d.ts +0 -16
- package/dist/types-ts4.5/plugins/tasks-and-decisions/index.d.ts +0 -3
- package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +0 -10
- package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/hooks/use-show-placeholder.d.ts +0 -11
- package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +0 -14
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/commands.d.ts +0 -15
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/helpers.d.ts +0 -76
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/input-rules.d.ts +0 -6
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +0 -11
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/main.d.ts +0 -7
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/plugin-key.d.ts +0 -2
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/types.d.ts +0 -8
- package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +0 -49
- package/dist/types-ts4.5/plugins/tasks-and-decisions/ui/Decision/index.d.ts +0 -14
- package/dist/types-ts4.5/plugins/tasks-and-decisions/ui/Task/index.d.ts +0 -28
- package/dist/types-ts4.5/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.d.ts +0 -29
- package/dist/types-ts4.5/plugins/tasks-and-decisions/ui/ToolbarDecision/index.d.ts +0 -23
- package/dist/types-ts4.5/plugins/tasks-and-decisions/ui/ToolbarTask/index.d.ts +0 -23
- package/dist/types-ts4.5/plugins/tasks-and-decisions/utils.d.ts +0 -4
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.taskItemNodeViewFactory = taskItemNodeViewFactory;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
18
|
-
var _steps = require("@atlaskit/adf-schema/steps");
|
|
19
|
-
var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
|
|
20
|
-
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
21
|
-
var _useShowPlaceholder = require("./hooks/use-show-placeholder");
|
|
22
|
-
var _Task = _interopRequireDefault(require("../ui/Task"));
|
|
23
|
-
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; }
|
|
24
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
25
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
26
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
27
|
-
var TaskItemWrapper = function TaskItemWrapper(_ref) {
|
|
28
|
-
var localId = _ref.localId,
|
|
29
|
-
forwardRef = _ref.forwardRef,
|
|
30
|
-
isDone = _ref.isDone,
|
|
31
|
-
onChange = _ref.onChange,
|
|
32
|
-
providerFactory = _ref.providerFactory,
|
|
33
|
-
isContentNodeEmpty = _ref.isContentNodeEmpty,
|
|
34
|
-
api = _ref.api,
|
|
35
|
-
getPos = _ref.getPos,
|
|
36
|
-
editorView = _ref.editorView;
|
|
37
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['taskDecision']),
|
|
38
|
-
taskDecisionState = _useSharedPluginState.taskDecisionState;
|
|
39
|
-
var isFocused = Boolean((taskDecisionState === null || taskDecisionState === void 0 ? void 0 : taskDecisionState.focusedTaskItemLocalId) === localId);
|
|
40
|
-
var showPlaceholder = (0, _useShowPlaceholder.useShowPlaceholder)({
|
|
41
|
-
editorView: editorView,
|
|
42
|
-
isContentNodeEmpty: isContentNodeEmpty,
|
|
43
|
-
getPos: getPos,
|
|
44
|
-
api: api
|
|
45
|
-
});
|
|
46
|
-
return /*#__PURE__*/_react.default.createElement(_Task.default, {
|
|
47
|
-
taskId: localId,
|
|
48
|
-
contentRef: forwardRef,
|
|
49
|
-
isDone: isDone,
|
|
50
|
-
onChange: onChange,
|
|
51
|
-
isFocused: isFocused,
|
|
52
|
-
showPlaceholder: showPlaceholder,
|
|
53
|
-
providers: providerFactory
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
var Task = /*#__PURE__*/function (_ReactNodeView) {
|
|
57
|
-
(0, _inherits2.default)(Task, _ReactNodeView);
|
|
58
|
-
var _super = _createSuper(Task);
|
|
59
|
-
function Task() {
|
|
60
|
-
var _this;
|
|
61
|
-
(0, _classCallCheck2.default)(this, Task);
|
|
62
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
63
|
-
args[_key] = arguments[_key];
|
|
64
|
-
}
|
|
65
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
66
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOnChange", function (taskId, isChecked) {
|
|
67
|
-
var tr = _this.view.state.tr;
|
|
68
|
-
var nodePos = _this.getPos();
|
|
69
|
-
if (typeof nodePos !== 'number') {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// SetAttrsStep should be used to prevent task updates from being dropped when mapping task ticks
|
|
74
|
-
// from a previous version of the document, such as a published page.
|
|
75
|
-
tr.step(new _steps.SetAttrsStep(nodePos, {
|
|
76
|
-
state: isChecked ? 'DONE' : 'TODO',
|
|
77
|
-
localId: taskId
|
|
78
|
-
}));
|
|
79
|
-
tr.setMeta('scrollIntoView', false);
|
|
80
|
-
_this.view.dispatch(tr);
|
|
81
|
-
});
|
|
82
|
-
/**
|
|
83
|
-
* Dynamically generates analytics data relating to the parent list.
|
|
84
|
-
*
|
|
85
|
-
* Required to be dynamic, as list (in prosemirror model) may have
|
|
86
|
-
* changed (e.g. item movements, or additional items in list).
|
|
87
|
-
* This node view will have not rerendered for those changes, so
|
|
88
|
-
* cannot render the position and listSize into the
|
|
89
|
-
* AnalyticsContext at initial render time.
|
|
90
|
-
*/
|
|
91
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "addListAnalyticsData", function (event) {
|
|
92
|
-
try {
|
|
93
|
-
var nodePos = _this.getPos();
|
|
94
|
-
if (typeof nodePos !== 'number') {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
var resolvedPos = _this.view.state.doc.resolve(nodePos);
|
|
98
|
-
var position = resolvedPos.index();
|
|
99
|
-
var listSize = resolvedPos.parent.childCount;
|
|
100
|
-
var listLocalId = resolvedPos.parent.attrs.localId;
|
|
101
|
-
event.update(function (payload) {
|
|
102
|
-
var _payload$attributes = payload.attributes,
|
|
103
|
-
attributes = _payload$attributes === void 0 ? {} : _payload$attributes,
|
|
104
|
-
actionSubject = payload.actionSubject;
|
|
105
|
-
if (actionSubject !== 'action') {
|
|
106
|
-
// Not action related, ignore
|
|
107
|
-
return payload;
|
|
108
|
-
}
|
|
109
|
-
return _objectSpread(_objectSpread({}, payload), {}, {
|
|
110
|
-
attributes: _objectSpread(_objectSpread({}, attributes), {}, {
|
|
111
|
-
position: position,
|
|
112
|
-
listSize: listSize,
|
|
113
|
-
listLocalId: listLocalId
|
|
114
|
-
})
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
} catch (e) {
|
|
118
|
-
// This can occur if pos is NaN (seen it in some test cases)
|
|
119
|
-
// Act defensively here, and lose some analytics data rather than
|
|
120
|
-
// cause any user facing error.
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
return _this;
|
|
124
|
-
}
|
|
125
|
-
(0, _createClass2.default)(Task, [{
|
|
126
|
-
key: "initWithAPI",
|
|
127
|
-
value: function initWithAPI(api) {
|
|
128
|
-
this.api = api;
|
|
129
|
-
this.init();
|
|
130
|
-
return this;
|
|
131
|
-
}
|
|
132
|
-
}, {
|
|
133
|
-
key: "isContentEmpty",
|
|
134
|
-
value: function isContentEmpty(node) {
|
|
135
|
-
return node.content.childCount === 0;
|
|
136
|
-
}
|
|
137
|
-
}, {
|
|
138
|
-
key: "createDomRef",
|
|
139
|
-
value: function createDomRef() {
|
|
140
|
-
var domRef = document.createElement('div');
|
|
141
|
-
domRef.style['list-style-type'] = 'none';
|
|
142
|
-
return domRef;
|
|
143
|
-
}
|
|
144
|
-
}, {
|
|
145
|
-
key: "getContentDOM",
|
|
146
|
-
value: function getContentDOM() {
|
|
147
|
-
var dom = document.createElement('div');
|
|
148
|
-
// setting a className prevents PM/Chrome mutation observer from
|
|
149
|
-
// incorrectly deleting nodes
|
|
150
|
-
dom.className = 'task-item';
|
|
151
|
-
return {
|
|
152
|
-
dom: dom
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
}, {
|
|
156
|
-
key: "render",
|
|
157
|
-
value: function render(props, forwardRef) {
|
|
158
|
-
var _this$node$attrs = this.node.attrs,
|
|
159
|
-
localId = _this$node$attrs.localId,
|
|
160
|
-
state = _this$node$attrs.state;
|
|
161
|
-
var isContentNodeEmpty = this.isContentEmpty(this.node);
|
|
162
|
-
return /*#__PURE__*/_react.default.createElement(_analyticsNext.AnalyticsListener, {
|
|
163
|
-
channel: "fabric-elements",
|
|
164
|
-
onEvent: this.addListAnalyticsData
|
|
165
|
-
}, /*#__PURE__*/_react.default.createElement(TaskItemWrapper, {
|
|
166
|
-
localId: localId,
|
|
167
|
-
forwardRef: forwardRef,
|
|
168
|
-
isDone: state === 'DONE',
|
|
169
|
-
onChange: this.handleOnChange,
|
|
170
|
-
isContentNodeEmpty: isContentNodeEmpty,
|
|
171
|
-
providerFactory: props.providerFactory
|
|
172
|
-
// The getPosHandler type is wrong, there is no `boolean` in the real implementation
|
|
173
|
-
// @ts-expect-error 2322: Type 'getPosHandler' is not assignable to type '() => number | undefined'.
|
|
174
|
-
,
|
|
175
|
-
getPos: this.getPos,
|
|
176
|
-
editorView: this.view,
|
|
177
|
-
api: this.api
|
|
178
|
-
}));
|
|
179
|
-
}
|
|
180
|
-
}, {
|
|
181
|
-
key: "viewShouldUpdate",
|
|
182
|
-
value: function viewShouldUpdate(nextNode) {
|
|
183
|
-
/**
|
|
184
|
-
* To ensure the placeholder is correctly toggled we need to allow react to re-render
|
|
185
|
-
* on first character insertion.
|
|
186
|
-
* Note: last character deletion is handled externally and automatically re-renders.
|
|
187
|
-
*/
|
|
188
|
-
return this.isContentEmpty(this.node) && !!nextNode.content.childCount;
|
|
189
|
-
}
|
|
190
|
-
}, {
|
|
191
|
-
key: "update",
|
|
192
|
-
value: function update(node, decorations) {
|
|
193
|
-
var _this2 = this;
|
|
194
|
-
return (0, _get2.default)((0, _getPrototypeOf2.default)(Task.prototype), "update", this).call(this, node, decorations, undefined, function (currentNode, newNode) {
|
|
195
|
-
return (
|
|
196
|
-
// Toggle the placeholder based on whether user input exists
|
|
197
|
-
!_this2.isContentEmpty(newNode) && !!(currentNode.attrs.state === newNode.attrs.state)
|
|
198
|
-
);
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}]);
|
|
202
|
-
return Task;
|
|
203
|
-
}(_reactNodeView.default);
|
|
204
|
-
function taskItemNodeViewFactory(portalProviderAPI, eventDispatcher, providerFactory, api) {
|
|
205
|
-
return function (node, view, getPos) {
|
|
206
|
-
var hasIntlContext = true;
|
|
207
|
-
return new Task(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
208
|
-
providerFactory: providerFactory
|
|
209
|
-
}, undefined, undefined, undefined, hasIntlContext).initWithAPI(api);
|
|
210
|
-
};
|
|
211
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.wrapSelectionInTaskList = exports.liftSelection = exports.joinAtCut = void 0;
|
|
7
|
-
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
8
|
-
var _commands = require("@atlaskit/editor-common/commands");
|
|
9
|
-
var _helpers = require("./helpers");
|
|
10
|
-
var _utils = require("../utils");
|
|
11
|
-
var liftSelection = exports.liftSelection = function liftSelection(state, dispatch) {
|
|
12
|
-
var normalizedSelection = (0, _utils.normalizeTaskItemsSelection)(state.selection);
|
|
13
|
-
var $from = normalizedSelection.$from,
|
|
14
|
-
$to = normalizedSelection.$to;
|
|
15
|
-
var tr = (0, _helpers.liftBlock)(state.tr, $from, $to);
|
|
16
|
-
if (dispatch && tr) {
|
|
17
|
-
dispatch(tr);
|
|
18
|
-
}
|
|
19
|
-
return !!tr;
|
|
20
|
-
};
|
|
21
|
-
var wrapSelectionInTaskList = exports.wrapSelectionInTaskList = function wrapSelectionInTaskList(state, dispatch) {
|
|
22
|
-
var _normalizeTaskItemsSe = (0, _utils.normalizeTaskItemsSelection)(state.selection),
|
|
23
|
-
$from = _normalizeTaskItemsSe.$from,
|
|
24
|
-
$to = _normalizeTaskItemsSe.$to;
|
|
25
|
-
|
|
26
|
-
// limit ui indentation to 6 levels
|
|
27
|
-
var _state$schema$nodes = state.schema.nodes,
|
|
28
|
-
taskList = _state$schema$nodes.taskList,
|
|
29
|
-
taskItem = _state$schema$nodes.taskItem;
|
|
30
|
-
var maxDepth = (0, _helpers.subtreeHeight)($from, $to, [taskList, taskItem]);
|
|
31
|
-
if (maxDepth >= 6) {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
var blockRange = (0, _helpers.getBlockRange)($from, $to);
|
|
35
|
-
if (!blockRange) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
var wrapping = (0, _transform.findWrapping)(blockRange, state.schema.nodes.taskList);
|
|
39
|
-
if (!wrapping) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
if (dispatch) {
|
|
43
|
-
dispatch(state.tr.wrap(blockRange, wrapping).scrollIntoView());
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Tries to move the paragraph content near the given position into the taskItem or decisionItem
|
|
50
|
-
* before it.
|
|
51
|
-
*
|
|
52
|
-
* Looks backwards from the given position to find the "cut point" between the last taskItem and the
|
|
53
|
-
* following paragraph. Then tries to move the content from that paragraph into the taskItem.
|
|
54
|
-
*
|
|
55
|
-
* @param $pos Position at the end of, or anywhere in paragraph following, the last taskItem
|
|
56
|
-
* @see {joinToPreviousListItem}
|
|
57
|
-
*/
|
|
58
|
-
var joinAtCut = exports.joinAtCut = function joinAtCut($pos) {
|
|
59
|
-
return function (state, dispatch) {
|
|
60
|
-
var $cut = (0, _commands.findCutBefore)($pos);
|
|
61
|
-
if (!$cut) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
var paragraph = $cut.doc.type.schema.nodes.paragraph;
|
|
65
|
-
|
|
66
|
-
// find the boundary between the taskList and paragraph
|
|
67
|
-
if ($cut.nodeBefore && (0, _helpers.isActionOrDecisionList)($cut.nodeBefore) && $cut.nodeAfter && $cut.nodeAfter.type === paragraph) {
|
|
68
|
-
// we'll find the boundary of a taskList
|
|
69
|
-
// so resolve -1 to find the inside end of the last taskItem
|
|
70
|
-
var $lastNode = $cut.doc.resolve($cut.pos - 1);
|
|
71
|
-
|
|
72
|
-
// might have deeply nested taskList, keep trying to find it
|
|
73
|
-
while (!(0, _helpers.isActionOrDecisionItem)($lastNode.parent)) {
|
|
74
|
-
$lastNode = state.doc.resolve($lastNode.pos - 1);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// grab the structure between the taskItem and the paragraph
|
|
78
|
-
// note: structure = true in ReplaceAroundStep
|
|
79
|
-
var slice = state.tr.doc.slice($lastNode.pos, $cut.pos);
|
|
80
|
-
|
|
81
|
-
// collapse the range between end of last taskItem and after the paragraph
|
|
82
|
-
// with the gap being the paragraph's content (i.e. take that content)
|
|
83
|
-
//
|
|
84
|
-
// we pass the structure we found earlier to join the p and taskItem nodes
|
|
85
|
-
//
|
|
86
|
-
// see https://prosemirror.net/docs/ref/#transform.ReplaceStep.constructor
|
|
87
|
-
// see https://prosemirror.net/docs/ref/#transform.ReplaceAroundStep.constructor
|
|
88
|
-
var tr = state.tr.step(new _transform.ReplaceAroundStep($lastNode.pos, $cut.pos + $cut.nodeAfter.nodeSize, $cut.pos + 1, $cut.pos + $cut.nodeAfter.nodeSize - 1, slice, 0, true));
|
|
89
|
-
if (dispatch) {
|
|
90
|
-
dispatch(tr);
|
|
91
|
-
}
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
return false;
|
|
95
|
-
};
|
|
96
|
-
};
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.focusCheckboxAndUpdateSelection = focusCheckboxAndUpdateSelection;
|
|
7
|
-
exports.getAllTaskItemsDataInRootTaskList = getAllTaskItemsDataInRootTaskList;
|
|
8
|
-
exports.getCurrentIndentLevel = exports.getBlockRange = void 0;
|
|
9
|
-
exports.getCurrentTaskItemIndex = getCurrentTaskItemIndex;
|
|
10
|
-
exports.getTaskItemDataAtPos = getTaskItemDataAtPos;
|
|
11
|
-
exports.getTaskItemDataToFocus = getTaskItemDataToFocus;
|
|
12
|
-
exports.liftBlock = exports.isTable = exports.isInsideTaskOrDecisionItem = exports.isInsideTask = exports.isInsideDecision = exports.isEmptyTaskDecision = exports.isActionOrDecisionList = exports.isActionOrDecisionItem = exports.getTaskItemIndex = void 0;
|
|
13
|
-
exports.removeCheckboxFocus = removeCheckboxFocus;
|
|
14
|
-
exports.walkOut = exports.subtreeHeight = void 0;
|
|
15
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
|
-
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
17
|
-
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
18
|
-
var _utils2 = require("../../../utils");
|
|
19
|
-
var _pluginKey = require("./plugin-key");
|
|
20
|
-
var _types = require("./types");
|
|
21
|
-
var isInsideTaskOrDecisionItem = exports.isInsideTaskOrDecisionItem = function isInsideTaskOrDecisionItem(state) {
|
|
22
|
-
var _state$schema$nodes = state.schema.nodes,
|
|
23
|
-
decisionItem = _state$schema$nodes.decisionItem,
|
|
24
|
-
taskItem = _state$schema$nodes.taskItem;
|
|
25
|
-
return (0, _utils.hasParentNodeOfType)([decisionItem, taskItem])(state.selection);
|
|
26
|
-
};
|
|
27
|
-
var isActionOrDecisionList = exports.isActionOrDecisionList = function isActionOrDecisionList(node) {
|
|
28
|
-
var _node$type$schema$nod = node.type.schema.nodes,
|
|
29
|
-
taskList = _node$type$schema$nod.taskList,
|
|
30
|
-
decisionList = _node$type$schema$nod.decisionList;
|
|
31
|
-
return [taskList, decisionList].indexOf(node.type) > -1;
|
|
32
|
-
};
|
|
33
|
-
var isActionOrDecisionItem = exports.isActionOrDecisionItem = function isActionOrDecisionItem(node) {
|
|
34
|
-
var _node$type$schema$nod2 = node.type.schema.nodes,
|
|
35
|
-
taskItem = _node$type$schema$nod2.taskItem,
|
|
36
|
-
decisionItem = _node$type$schema$nod2.decisionItem;
|
|
37
|
-
return [taskItem, decisionItem].indexOf(node.type) > -1;
|
|
38
|
-
};
|
|
39
|
-
var isInsideTask = exports.isInsideTask = function isInsideTask(state) {
|
|
40
|
-
var taskItem = state.schema.nodes.taskItem;
|
|
41
|
-
return (0, _utils.hasParentNodeOfType)([taskItem])(state.selection);
|
|
42
|
-
};
|
|
43
|
-
var isInsideDecision = exports.isInsideDecision = function isInsideDecision(state) {
|
|
44
|
-
var decisionItem = state.schema.nodes.decisionItem;
|
|
45
|
-
return (0, _utils.hasParentNodeOfType)([decisionItem])(state.selection);
|
|
46
|
-
};
|
|
47
|
-
var isTable = exports.isTable = function isTable(node) {
|
|
48
|
-
if (!node) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
var _node$type$schema$nod3 = node.type.schema.nodes,
|
|
52
|
-
table = _node$type$schema$nod3.table,
|
|
53
|
-
tableHeader = _node$type$schema$nod3.tableHeader,
|
|
54
|
-
tableCell = _node$type$schema$nod3.tableCell,
|
|
55
|
-
tableRow = _node$type$schema$nod3.tableRow;
|
|
56
|
-
return [table, tableHeader, tableCell, tableRow].includes(node.type);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Creates a NodeRange around the given taskItem and the following
|
|
61
|
-
* ("nested") taskList, if one exists.
|
|
62
|
-
*/
|
|
63
|
-
var getBlockRange = exports.getBlockRange = function getBlockRange($from, $to) {
|
|
64
|
-
var taskList = $from.doc.type.schema.nodes.taskList;
|
|
65
|
-
var end = $to.end();
|
|
66
|
-
var $after = $to.doc.resolve(end + 1);
|
|
67
|
-
var after = $after.nodeAfter;
|
|
68
|
-
|
|
69
|
-
// ensure the node after is actually just a sibling
|
|
70
|
-
// $to will be inside the text, so subtract one to get the taskItem it contains in
|
|
71
|
-
if (after && after.type === taskList && $after.depth === $to.depth - 1) {
|
|
72
|
-
// it was! include it in our blockRange
|
|
73
|
-
end += after.nodeSize;
|
|
74
|
-
}
|
|
75
|
-
return $from.blockRange($to.doc.resolve(end));
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Finds the distance between the current $from and the root of the taskList.
|
|
80
|
-
*/
|
|
81
|
-
var getCurrentIndentLevel = exports.getCurrentIndentLevel = function getCurrentIndentLevel(selection) {
|
|
82
|
-
var $from = selection.$from;
|
|
83
|
-
var taskList = $from.doc.type.schema.nodes.taskList;
|
|
84
|
-
var furthestParent = (0, _utils2.findFarthestParentNode)(function (node) {
|
|
85
|
-
return node.type === taskList;
|
|
86
|
-
})($from);
|
|
87
|
-
if (!furthestParent) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
return $from.depth - furthestParent.depth;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Finds the index of the current task item in relation to the closest taskList
|
|
95
|
-
*/
|
|
96
|
-
var getTaskItemIndex = exports.getTaskItemIndex = function getTaskItemIndex(state) {
|
|
97
|
-
var $pos = state.selection.$from;
|
|
98
|
-
var isTaskList = function isTaskList(node) {
|
|
99
|
-
return (node === null || node === void 0 ? void 0 : node.type.name) === 'taskList';
|
|
100
|
-
};
|
|
101
|
-
var itemAtPos = (0, _utils.findParentNodeClosestToPos)($pos, isTaskList);
|
|
102
|
-
return $pos.index(itemAtPos ? itemAtPos.depth : undefined);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Walk outwards from a position until we encounter the (inside) start of
|
|
107
|
-
* the next node, or reach the end of the document.
|
|
108
|
-
*
|
|
109
|
-
* @param $startPos Position to start walking from.
|
|
110
|
-
*/
|
|
111
|
-
var walkOut = exports.walkOut = function walkOut($startPos) {
|
|
112
|
-
var $pos = $startPos;
|
|
113
|
-
|
|
114
|
-
// invariant 1: don't walk past the end of the document
|
|
115
|
-
// invariant 2: we haven't walked to the start of *any* node
|
|
116
|
-
// parentOffset includes textOffset.
|
|
117
|
-
while ($pos.pos < $pos.doc.nodeSize - 2 && $pos.parentOffset > 0) {
|
|
118
|
-
$pos = $pos.doc.resolve($pos.pos + 1);
|
|
119
|
-
}
|
|
120
|
-
return $pos;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Finds the height of a tree-like structure, given any position inside it.
|
|
125
|
-
*
|
|
126
|
-
* Traverses from the top of the tree to all leaf nodes, and returns the length
|
|
127
|
-
* of the longest path.
|
|
128
|
-
*
|
|
129
|
-
* This means you can use it with things like taskList, which
|
|
130
|
-
* do not nest themselves inside taskItems but rather as adjacent children.
|
|
131
|
-
*
|
|
132
|
-
* @param $pos Any position inside the tree.
|
|
133
|
-
* @param types The node types to consider traversable
|
|
134
|
-
*/
|
|
135
|
-
var subtreeHeight = exports.subtreeHeight = function subtreeHeight($from, $to, types) {
|
|
136
|
-
var root = (0, _utils2.findFarthestParentNode)(function (node) {
|
|
137
|
-
return types.indexOf(node.type) > -1;
|
|
138
|
-
})($from);
|
|
139
|
-
if (!root) {
|
|
140
|
-
return -1;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// get the height between the root and the current position
|
|
144
|
-
var distToParent = $from.depth - root.depth;
|
|
145
|
-
|
|
146
|
-
// include any following taskList since nested lists appear
|
|
147
|
-
// as siblings
|
|
148
|
-
//
|
|
149
|
-
// this is unlike regular bullet lists where the orderedList
|
|
150
|
-
// appears as descendent of listItem
|
|
151
|
-
var blockRange = getBlockRange($from, $to);
|
|
152
|
-
if (!blockRange) {
|
|
153
|
-
return -1;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// and get the max height from the current position to the
|
|
157
|
-
// deepest leaf node
|
|
158
|
-
var maxChildDepth = $from.depth;
|
|
159
|
-
$from.doc.nodesBetween(blockRange.start, blockRange.end, function (descendent, relPos, parent) {
|
|
160
|
-
maxChildDepth = Math.max($from.doc.resolve(relPos).depth, maxChildDepth);
|
|
161
|
-
|
|
162
|
-
// keep descending down the tree if we can
|
|
163
|
-
if (types.indexOf(descendent.type) > -1) {
|
|
164
|
-
return true;
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
return distToParent + (maxChildDepth - $from.depth);
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Returns `true` if the taskItem or decisionItem has no text.
|
|
172
|
-
*/
|
|
173
|
-
var isEmptyTaskDecision = exports.isEmptyTaskDecision = function isEmptyTaskDecision(state) {
|
|
174
|
-
var selection = state.selection,
|
|
175
|
-
schema = state.schema;
|
|
176
|
-
var $from = selection.$from;
|
|
177
|
-
var node = $from.node($from.depth);
|
|
178
|
-
return node && (node.type === schema.nodes.taskItem || node.type === schema.nodes.decisionItem) && node.content.size === 0;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Lifts a taskItem and any directly following taskList
|
|
183
|
-
* (taskItem and its "nested children") out one level.
|
|
184
|
-
*
|
|
185
|
-
* @param tr Transaction to base steps on
|
|
186
|
-
* @param $from Start of range you want to lift
|
|
187
|
-
* @param $to End of range you want to lift (can be same as `$from`)
|
|
188
|
-
*/
|
|
189
|
-
var liftBlock = exports.liftBlock = function liftBlock(tr, $from, $to) {
|
|
190
|
-
var blockRange = getBlockRange($from, $to);
|
|
191
|
-
if (!blockRange) {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// ensure we can actually lift
|
|
196
|
-
var target = (0, _transform.liftTarget)(blockRange);
|
|
197
|
-
if (typeof target !== 'number') {
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
return tr.lift(blockRange, target).scrollIntoView();
|
|
201
|
-
};
|
|
202
|
-
function getTaskItemDataAtPos(view) {
|
|
203
|
-
var state = view.state;
|
|
204
|
-
var selection = state.selection,
|
|
205
|
-
schema = state.schema;
|
|
206
|
-
var $from = selection.$from;
|
|
207
|
-
var isInTaskItem = $from.node().type === schema.nodes.taskItem;
|
|
208
|
-
|
|
209
|
-
// current selection has to be inside taskitem
|
|
210
|
-
if (isInTaskItem) {
|
|
211
|
-
var taskItemPos = $from.before();
|
|
212
|
-
return {
|
|
213
|
-
pos: taskItemPos,
|
|
214
|
-
localId: $from.node().attrs.localId
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
function getAllTaskItemsDataInRootTaskList(view) {
|
|
219
|
-
var state = view.state;
|
|
220
|
-
var schema = state.schema;
|
|
221
|
-
var $fromPos = state.selection.$from;
|
|
222
|
-
var isInTaskItem = $fromPos.node().type === schema.nodes.taskItem;
|
|
223
|
-
// if not inside task item then return undefined;
|
|
224
|
-
if (!isInTaskItem) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
var _schema$nodes = schema.nodes,
|
|
228
|
-
taskList = _schema$nodes.taskList,
|
|
229
|
-
taskItem = _schema$nodes.taskItem;
|
|
230
|
-
var rootTaskListData = (0, _utils2.findFarthestParentNode)(function (node) {
|
|
231
|
-
return node.type === taskList;
|
|
232
|
-
})($fromPos);
|
|
233
|
-
if (rootTaskListData) {
|
|
234
|
-
var rootTaskList = rootTaskListData.node;
|
|
235
|
-
var rootTaskListStartPos = rootTaskListData.start;
|
|
236
|
-
var allTaskItems = [];
|
|
237
|
-
rootTaskList.descendants(function (node, pos, parent, index) {
|
|
238
|
-
if (node.type === taskItem) {
|
|
239
|
-
allTaskItems.push({
|
|
240
|
-
node: node,
|
|
241
|
-
pos: pos + rootTaskListStartPos,
|
|
242
|
-
index: index
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
return allTaskItems;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
function getCurrentTaskItemIndex(view, allTaskItems) {
|
|
250
|
-
var state = view.state;
|
|
251
|
-
var $fromPos = state.selection.$from;
|
|
252
|
-
var allTaskItemNodes = allTaskItems.map(function (nodeData) {
|
|
253
|
-
return nodeData.node;
|
|
254
|
-
});
|
|
255
|
-
var currentTaskItem = $fromPos.node($fromPos.depth);
|
|
256
|
-
var currentTaskItemIndex = allTaskItemNodes.indexOf(currentTaskItem);
|
|
257
|
-
return currentTaskItemIndex;
|
|
258
|
-
}
|
|
259
|
-
function getTaskItemDataToFocus(view, direction) {
|
|
260
|
-
var allTaskItems = getAllTaskItemsDataInRootTaskList(view);
|
|
261
|
-
// if not inside task item then allTaskItems will be undefined;
|
|
262
|
-
if (!allTaskItems) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
var currentTaskItemIndex = getCurrentTaskItemIndex(view, allTaskItems);
|
|
266
|
-
if (direction === 'next' ? currentTaskItemIndex === allTaskItems.length - 1 : currentTaskItemIndex === 0) {
|
|
267
|
-
// checkbox of first or last task item is already focused based on direction.
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
var indexOfTaskItemToFocus = direction === 'next' ? currentTaskItemIndex + 1 : currentTaskItemIndex - 1;
|
|
271
|
-
var taskItemToFocus = allTaskItems[indexOfTaskItemToFocus];
|
|
272
|
-
return {
|
|
273
|
-
pos: taskItemToFocus.pos,
|
|
274
|
-
localId: taskItemToFocus.node.attrs.localId
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
function focusCheckboxAndUpdateSelection(view, taskItemData) {
|
|
278
|
-
var pos = taskItemData.pos,
|
|
279
|
-
localId = taskItemData.localId;
|
|
280
|
-
var state = view.state,
|
|
281
|
-
dispatch = view.dispatch;
|
|
282
|
-
var doc = state.doc,
|
|
283
|
-
tr = state.tr;
|
|
284
|
-
tr.setSelection(new _state.TextSelection(doc.resolve(pos + 1)));
|
|
285
|
-
tr.setMeta(_pluginKey.stateKey, {
|
|
286
|
-
action: _types.ACTIONS.FOCUS_BY_LOCALID,
|
|
287
|
-
data: localId
|
|
288
|
-
});
|
|
289
|
-
dispatch(tr);
|
|
290
|
-
}
|
|
291
|
-
function removeCheckboxFocus(view) {
|
|
292
|
-
var state = view.state,
|
|
293
|
-
dispatch = view.dispatch;
|
|
294
|
-
var tr = state.tr;
|
|
295
|
-
view.focus();
|
|
296
|
-
dispatch(tr.setMeta(_pluginKey.stateKey, {
|
|
297
|
-
action: _types.ACTIONS.FOCUS_BY_LOCALID
|
|
298
|
-
}));
|
|
299
|
-
}
|