@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
45 lines (42 loc) • 2.31 kB
JavaScript
import _defineProperty from "@babel/runtime/helpers/defineProperty";
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; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
import { taskList as taskListFactory, taskListWithFlexibleFirstChildStage0 as taskListWithFlexibleFirstChildStage0Factory } from '../../next-schema/generated/nodeTypes';
import { uuid } from '../../utils/uuid';
/**
* @name taskList_node
*/
var name = 'actionList';
export var taskListSelector = "[data-node-type=\"".concat(name, "\"]");
var taskListParseDOMAndToDOM = {
parseDOM: [{
tag: "div".concat(taskListSelector),
// Default priority is 50. We normally don't change this but since this node type is
// also used by ordered-list we need to make sure that we run this parser first.
priority: 100,
getAttrs: function getAttrs() {
return {
localId: uuid.generate()
};
}
}],
toDOM: function toDOM(node) {
var localId = node.attrs.localId;
var attrs = {
'data-node-type': name,
'data-task-list-local-id': localId || 'local-task-list',
style: 'list-style: none; padding-left: 0'
};
return ['div', attrs, 0];
}
};
export var taskList = taskListFactory(taskListParseDOMAndToDOM);
var taskListWithFlexibleFirstChild = taskListWithFlexibleFirstChildStage0Factory(taskListParseDOMAndToDOM);
/**
* @name task_list_with_flexible_first_child_stage0
* @description stage0 taskList with flexible first child content (see EDITOR-5417)
*/
export var taskListWithFlexibleFirstChildStage0 = _objectSpread(_objectSpread({}, taskListWithFlexibleFirstChild), {}, {
// Generated spec omits PM group; keep taskList in block content for doc validation.
group: 'block'
});