UNPKG

@atlaskit/editor-plugin-tasks-and-decisions

Version:

Tasks and decisions plugin for @atlaskit/editor-core

74 lines 3.59 kB
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 { decisionItem } from '@atlaskit/adf-schema'; import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view'; import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments'; // @nodeSpecException:toDOM patch export var decisionItemSpecWithFixedToDOM = function decisionItemSpecWithFixedToDOM() { if (editorExperiment('platform_editor_exp_lazy_node_views', false)) { return decisionItem; } return _objectSpread(_objectSpread({}, decisionItem), {}, { toDOM: function toDOM(node) { var _node$attrs = node.attrs, localId = _node$attrs.localId, state = _node$attrs.state; var attrs = { 'data-decision-local-id': localId || 'local-decision', 'data-decision-state': state, class: 'decisionItemView-content-wrap' }; var showPlaceholder = node.content.size === 0; return ['li', attrs, ['div', { 'data-decision-wrapper': true, 'data-testid': 'elements-decision-item', // Styles to match `packages/elements/task-decision/src/components/styles.ts` style: convertToInlineCss({ background: "var(--ds-background-neutral, #0515240F)", padding: "var(--ds-space-100, 8px)", paddingLeft: "var(--ds-space-150, 12px)", margin: "var(--ds-space-100, 8px)".concat(" 0 0 0"), display: 'flex', borderRadius: "var(--ds-radius-small, 3px)" }) }, ['span', { style: convertToInlineCss({ width: '16px', height: '16px', margin: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-150, 12px)", " 0 0"), color: showPlaceholder ? "var(--ds-icon-subtle, #505258)" : "var(--ds-icon-success, #6A9A23)", display: 'flex', alignItems: 'center', justifyContent: 'center' }), contentEditable: 'false', 'data-component': 'icon' }, ['span', { role: 'img', style: convertToInlineCss({ width: '32px', height: '32px' }) }, ['http://www.w3.org/2000/svg svg', { viewBox: "0 0 24 24", role: 'presentation', width: '24', height: '24', 'data-icon-source': 'legacy', style: convertToInlineCss({ width: '32px', height: '32px' }) }, ['http://www.w3.org/2000/svg path', { fill: 'currentcolor', 'fill-rule': 'evenodd', d: 'm9.414 8 3.293 3.293c.187.187.293.442.293.707v5a1 1 0 0 1-2 0v-4.586l-3-3V10.5a1 1 0 0 1-2 0V7a1 1 0 0 1 1-1h3.5a1 1 0 0 1 0 2zm8.293-1.707a1 1 0 0 1 0 1.414l-2.5 2.5a.997.997 0 0 1-1.414 0 1 1 0 0 1 0-1.414l2.5-2.5a1 1 0 0 1 1.414 0' }]]]], ['div', { 'data-component': 'content' }, ['div', { class: 'decision-item' }, 0]]]]; } }); };