@coorax/core 0.0.0-canary.0 → 0.0.0-canary.2

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 (143) hide show
  1. package/dist/base/classes/component.class.d.ts +23 -0
  2. package/dist/base/classes/container.class.d.ts +17 -0
  3. package/dist/base/classes/field.class.d.ts +15 -0
  4. package/dist/base/classes/tnode.class.d.ts +14 -0
  5. package/{src/base/index.ts → dist/base/index.d.ts} +0 -4
  6. package/dist/base/types/components/components.d.ts +13 -0
  7. package/dist/base/types/container/container.d.ts +27 -0
  8. package/dist/base/types/container/division.types.d.ts +3 -0
  9. package/{src/base/types/container/section.types.ts → dist/base/types/container/section.types.d.ts} +2 -2
  10. package/{src/base/types/container/ul-list.types.ts → dist/base/types/container/ul-list.types.d.ts} +2 -2
  11. package/dist/base/types/css.types.d.ts +23 -0
  12. package/dist/base/types/field/divider.types.d.ts +3 -0
  13. package/dist/base/types/field/field.blockquote.types.d.ts +4 -0
  14. package/dist/base/types/field/field.d.ts +50 -0
  15. package/dist/base/types/field/field.image.types.d.ts +3 -0
  16. package/{src/base/types/field/field.media.types.ts → dist/base/types/field/field.media.types.d.ts} +2 -3
  17. package/{src/base/types/field/field.text.types.ts → dist/base/types/field/field.text.types.d.ts} +4 -5
  18. package/dist/base/types/field/field.video.types.d.ts +8 -0
  19. package/dist/base/types/field/fields.iframe.types.d.ts +7 -0
  20. package/{src/base/types/field/heading.types.ts → dist/base/types/field/heading.types.d.ts} +2 -2
  21. package/{src/base/types/field/paragraph.types.ts → dist/base/types/field/paragraph.types.d.ts} +2 -2
  22. package/dist/base/types/global.types.d.ts +26 -0
  23. package/{src/base/types/node/span.types.ts → dist/base/types/node/link.types.d.ts} +2 -2
  24. package/{src/base/types/node/node.ts → dist/base/types/node/node.d.ts} +13 -17
  25. package/{src/base/types/node/link.types.ts → dist/base/types/node/span.types.d.ts} +2 -2
  26. package/dist/base/types/tree/tree.d.ts +24 -0
  27. package/dist/constants/field.constants.d.ts +1 -0
  28. package/dist/constants/index.d.ts +1 -0
  29. package/{src/engine/engine.ts → dist/engine/engine.d.ts} +20 -24
  30. package/dist/engine/engine.test.d.ts +1 -0
  31. package/{src/index.ts → dist/index.d.ts} +1 -2
  32. package/dist/index.js +3252 -0
  33. package/dist/modules/caption/caption.module.d.ts +35 -0
  34. package/dist/modules/caption/caption.test.d.ts +1 -0
  35. package/dist/modules/code/code.module.d.ts +37 -0
  36. package/dist/modules/deletion/deletion.module.d.ts +26 -0
  37. package/dist/modules/editor/editor.module.d.ts +44 -0
  38. package/dist/modules/focus/focus.module.d.ts +54 -0
  39. package/dist/modules/history/history.module.d.ts +41 -0
  40. package/dist/modules/hover/hover.module.d.ts +53 -0
  41. package/{src/modules/index.ts → dist/modules/index.d.ts} +3 -1
  42. package/dist/modules/insertion/insertion.module.d.ts +71 -0
  43. package/dist/modules/modules-manager.d.ts +43 -0
  44. package/{src/modules/modules.types.ts → dist/modules/modules.types.d.ts} +25 -30
  45. package/dist/modules/selection/selection.module.d.ts +60 -0
  46. package/dist/modules/selection/selection.test.d.ts +1 -0
  47. package/dist/modules/text-editing/text-editing.constants.d.ts +2 -0
  48. package/dist/modules/text-editing/text-editing.module.d.ts +82 -0
  49. package/dist/modules/text-editing/text-editing.utils.d.ts +6 -0
  50. package/dist/services/commandsbus/commandsbus.d.ts +53 -0
  51. package/dist/services/commandsbus/commandsbus.test.d.ts +17 -0
  52. package/dist/services/document/document.d.ts +44 -0
  53. package/dist/services/eventbus/eventbus.d.ts +86 -0
  54. package/dist/services/eventbus/eventbus.test.d.ts +8 -0
  55. package/dist/services/eventbus/subscriber.d.ts +18 -0
  56. package/dist/services/mutations/mutations.d.ts +43 -0
  57. package/dist/services/mutations/mutations.errors.d.ts +6 -0
  58. package/dist/services/mutations/mutations.test.d.ts +1 -0
  59. package/dist/services/shortcuts/shortcuts.d.ts +4 -0
  60. package/dist/services/state/state.d.ts +20 -0
  61. package/dist/services/state/state.errors.d.ts +6 -0
  62. package/dist/services/tasks/tasks.service.d.ts +106 -0
  63. package/dist/services/tasks/tasks.service.test.d.ts +7 -0
  64. package/dist/services/text-marks/index.d.ts +1 -0
  65. package/{src/services/text-marks/marks.types.ts → dist/services/text-marks/marks.types.d.ts} +20 -23
  66. package/dist/services/text-marks/text-marks.d.ts +45 -0
  67. package/dist/services/ui/contributions.types.d.ts +79 -0
  68. package/dist/services/ui/default-styles.d.ts +3 -0
  69. package/{src/services/ui/index.ts → dist/services/ui/index.d.ts} +0 -1
  70. package/dist/services/ui/ui.d.ts +23 -0
  71. package/dist/services/ui/ui.errors.d.ts +3 -0
  72. package/dist/services/ui/ui.types.d.ts +25 -0
  73. package/dist/styles.css +2 -0
  74. package/dist/utils/components.utils.d.ts +10 -0
  75. package/dist/utils/container.utils.d.ts +13 -0
  76. package/dist/utils/fields.utils.d.ts +27 -0
  77. package/dist/utils/global.utils.d.ts +47 -0
  78. package/dist/utils/index.d.ts +1 -0
  79. package/dist/utils/modules.utils.d.ts +11 -0
  80. package/dist/utils/tnode.utils.d.ts +9 -0
  81. package/dist/utils/tree.utils.d.ts +11 -0
  82. package/package.json +23 -6
  83. package/styles.css +4 -4
  84. package/src/base/classes/component.class.ts +0 -68
  85. package/src/base/classes/container.class.ts +0 -57
  86. package/src/base/classes/field.class.ts +0 -42
  87. package/src/base/classes/tnode.class.ts +0 -38
  88. package/src/base/types/components/components.ts +0 -21
  89. package/src/base/types/container/container.ts +0 -37
  90. package/src/base/types/container/division.types.ts +0 -3
  91. package/src/base/types/css.types.ts +0 -33
  92. package/src/base/types/field/divider.types.ts +0 -3
  93. package/src/base/types/field/field.ts +0 -46
  94. package/src/base/types/global.types.ts +0 -45
  95. package/src/base/types/tree/tree.ts +0 -33
  96. package/src/engine/engine.test.ts +0 -27
  97. package/src/modules/editor/editor.module.ts +0 -119
  98. package/src/modules/focus/focus.module.ts +0 -185
  99. package/src/modules/history/history.module.ts +0 -60
  100. package/src/modules/hover/hover.module.ts +0 -121
  101. package/src/modules/insertion/insertion.module.ts +0 -140
  102. package/src/modules/modules-manager.ts +0 -132
  103. package/src/modules/selection/selection.module.ts +0 -174
  104. package/src/modules/selection/selection.test.ts +0 -1
  105. package/src/modules/text-editing/text-editing.constants.ts +0 -6
  106. package/src/modules/text-editing/text-editing.module.ts +0 -377
  107. package/src/modules/text-editing/text-editing.utils.ts +0 -27
  108. package/src/services/commandsbus/commandsbus.test.ts +0 -312
  109. package/src/services/commandsbus/commandsbus.ts +0 -360
  110. package/src/services/document/document.ts +0 -139
  111. package/src/services/eventbus/eventbus.test.ts +0 -144
  112. package/src/services/eventbus/eventbus.ts +0 -162
  113. package/src/services/eventbus/subscriber.ts +0 -46
  114. package/src/services/mutations/mutations.errors.ts +0 -12
  115. package/src/services/mutations/mutations.test.ts +0 -177
  116. package/src/services/mutations/mutations.ts +0 -457
  117. package/src/services/shortcuts/shortcuts.ts +0 -3
  118. package/src/services/state/state.errors.ts +0 -12
  119. package/src/services/state/state.ts +0 -64
  120. package/src/services/tasks/tasks.service.test.ts +0 -193
  121. package/src/services/tasks/tasks.service.ts +0 -288
  122. package/src/services/text-marks/index.ts +0 -2
  123. package/src/services/text-marks/text-marks.ts +0 -244
  124. package/src/services/ui/default-styles.ts +0 -93
  125. package/src/services/ui/ui.errors.ts +0 -6
  126. package/src/services/ui/ui.ts +0 -148
  127. package/src/services/ui/ui.types.ts +0 -197
  128. package/src/utils/components.utils.ts +0 -26
  129. package/src/utils/container.utils.ts +0 -59
  130. package/src/utils/fields.utils.ts +0 -118
  131. package/src/utils/global.utils.ts +0 -128
  132. package/src/utils/index.ts +0 -7
  133. package/src/utils/modules.utils.ts +0 -110
  134. package/src/utils/tnode.utils.ts +0 -48
  135. package/src/utils/tree.utils.ts +0 -120
  136. package/tsconfig.json +0 -9
  137. /package/{src/engine/index.ts → dist/engine/index.d.ts} +0 -0
  138. /package/{src/services/commandsbus/index.ts → dist/services/commandsbus/index.d.ts} +0 -0
  139. /package/{src/services/document/index.ts → dist/services/document/index.d.ts} +0 -0
  140. /package/{src/services/eventbus/index.ts → dist/services/eventbus/index.d.ts} +0 -0
  141. /package/{src/services/mutations/index.ts → dist/services/mutations/index.d.ts} +0 -0
  142. /package/{src/services/state/index.ts → dist/services/state/index.d.ts} +0 -0
  143. /package/{src/services/tasks/index.ts → dist/services/tasks/index.d.ts} +0 -0
@@ -1,140 +0,0 @@
1
- import type { FieldId } from "../../base";
2
- import type { Block, BlockId } from "../../base/types/tree/tree";
3
- import type { CommandMap } from "../../services/commandsbus/commandsbus";
4
- import type { Contribution, ContributionId, SlotIcon } from "../../services/ui/ui.types";
5
- import { FieldsUtils } from "../../utils/fields.utils";
6
- import type { TModule } from "../modules.types";
7
-
8
- declare module "../../services/commandsbus/commandsbus" {
9
- interface CommandMap {
10
- "blocks.insert": { payload: { block: Block; pos?: number }; result: void };
11
- "blocks.delete": { payload: { blockId: BlockId }; result: void };
12
- "actions.toggle": { payload: boolean; result: void };
13
- }
14
- }
15
-
16
- declare module "../../services/eventbus/eventbus" {
17
- interface TEventMap {
18
- "blocks:insert": CommandMap["blocks.insert"]["payload"];
19
- "blocks:delete": CommandMap["blocks.delete"]["payload"];
20
- "actions:toggle": CommandMap["actions.toggle"]["payload"];
21
- }
22
- }
23
-
24
- declare module "../../services/state/state" {
25
- interface StateMap {
26
- insertion: boolean;
27
- }
28
- }
29
-
30
- declare module "../modules-manager" {
31
- interface ModuleMap {
32
- insertion: {};
33
- }
34
- }
35
-
36
- declare module "../../services/ui/ui" {
37
- interface ButtonContributionIdentityMap {
38
- "insert-field": {};
39
- "insert-heading": {};
40
- "insert-text": {};
41
- "insert-image": {};
42
- "insert-divider": {};
43
- }
44
-
45
- interface IconMap {
46
- DividerIcon: {};
47
- }
48
- }
49
-
50
- const ActionsOpenerContribution: Contribution<"block-actions", "actions.toggle", "button"> = {
51
- id: "insert-field",
52
- slot: "block-actions",
53
- order: 0,
54
- kind: "button",
55
- command: "actions.toggle",
56
- icon: "PlusIcon",
57
- getPayload: () => true,
58
- name: "BlockActionButton",
59
- getProps() {
60
- // ui.translate("Insert block")
61
- return { variant: "secondary", size: "icon-lg", isBaseButton: true };
62
- },
63
- when() {
64
- return true;
65
- },
66
- };
67
-
68
- export const InsertionModule: TModule = {
69
- name: "insertion",
70
- version: "1.0.0",
71
- requires: [],
72
- install(ctx) {
73
- ctx.state.defineSlice("insertion", false);
74
-
75
- ctx.commands.register("actions.toggle", (isOpen) => {
76
- ctx.state.set("insertion", isOpen);
77
- ctx.events.emit("actions:toggle", isOpen);
78
- });
79
-
80
- ctx.commands.register("blocks.insert", ({ block, pos }) => {
81
- const isNotMedia = block.type !== "image" && block.type !== "video";
82
- const hasSrcInProps = "src" in block.props && !!block.props.src.trim();
83
-
84
- const shouldEmitEvent = isNotMedia || hasSrcInProps;
85
-
86
- ctx.document.apply(
87
- (tree) => {
88
- // #TODO handle others block
89
- if (block.variant === "field") {
90
- return ctx.mutations.insertField(tree, block, pos);
91
- }
92
- return tree;
93
- },
94
- { shouldEmitEvent },
95
- );
96
-
97
- ctx.state.set("insertion", false);
98
- ctx.events.emit("blocks:insert", { block, pos });
99
- });
100
-
101
- ctx.commands.register("blocks.delete", ({ blockId }) => {
102
- const isFieldBlock = blockId.startsWith("field:");
103
- if (!isFieldBlock) return;
104
-
105
- ctx.document.apply((tree) => ctx.mutations.deleteField(tree, blockId as FieldId));
106
-
107
- ctx.events.emit("blocks:delete", { blockId });
108
- });
109
-
110
- function actionButton(id: ContributionId, block: Block, icon: SlotIcon, order: number) {
111
- ctx.ui.contribute("block-actions", {
112
- id,
113
- order,
114
- icon,
115
- kind: "button",
116
- slot: "block-actions",
117
- command: "blocks.insert",
118
- name: "BlockActionButton",
119
- getProps() {
120
- // ui.translate("Insert block")
121
- return { variant: "outline", size: "icon" };
122
- },
123
- getPayload: () => ({ block }),
124
- when() {
125
- return true;
126
- },
127
- });
128
- }
129
-
130
- ctx.ui.contribute("block-actions", {
131
- ...ActionsOpenerContribution,
132
- getPayload: () => !ctx.state.get("insertion"),
133
- });
134
-
135
- actionButton("insert-heading", FieldsUtils.NewHeadingField(), "HeadingIcon", 1);
136
- actionButton("insert-text", FieldsUtils.NewTextField(), "TextIcon", 2);
137
- actionButton("insert-image", FieldsUtils.NewImageField(), "ImagePlus", 3);
138
- actionButton("insert-divider", FieldsUtils.NewDividerField(), "DividerIcon", 4);
139
- },
140
- };
@@ -1,132 +0,0 @@
1
- import type { Engine } from "../engine/engine";
2
- import { ModuleUtils } from "../utils";
3
- import type { ModuleDisposer, TModule } from "./modules.types";
4
-
5
- export interface ModuleMap {}
6
-
7
- export type ModuleName = keyof ModuleMap;
8
-
9
- export interface ModuleManagerInterface {
10
- register(modules: TModule[]): void;
11
- isEnabled(name: ModuleName): boolean;
12
-
13
- enable(name: ModuleName): void;
14
- enableAll(): void;
15
-
16
- disable(name: ModuleName, opts?: { cascade?: boolean }): void;
17
- disabledAll(): void;
18
- unregister(name: ModuleName): void;
19
- }
20
-
21
- export class ModuleManager implements ModuleManagerInterface {
22
- private registry = new Map<ModuleName, TModule>();
23
- private active = new Map<ModuleName, ModuleDisposer>();
24
-
25
- private engine: Engine;
26
-
27
- constructor(engine: Engine) {
28
- this.engine = engine;
29
- }
30
-
31
- register(modules: TModule[]): void {
32
- for (const module of modules) {
33
- if (this.registry.has(module.name)) {
34
- throw new Error(`Module "${module.name}" is already registered`);
35
- }
36
-
37
- this.registry.set(module.name, module);
38
- }
39
- }
40
-
41
- isEnabled(name: ModuleName): boolean {
42
- return this.active.has(name);
43
- }
44
-
45
- enable(name: ModuleName): void {
46
- this.enableRec(name, []);
47
- }
48
-
49
- enableAll(): void {
50
- for (const name of this.registry.keys()) this.enable(name);
51
- }
52
-
53
- disabledAll(): void {
54
- for (const name of this.registry.keys()) this.disable(name, { cascade: true });
55
- }
56
-
57
- disable(name: ModuleName, opts: { cascade?: boolean } = {}): void {
58
- const cleanup = this.active.get(name);
59
- if (!cleanup) return;
60
-
61
- const dependents = this.activeDependentsOf(name);
62
- if (dependents.length > 0) {
63
- if (!opts.cascade) {
64
- throw new Error(`Cannot disable "${name}": required by ${dependents.join(", ")}`);
65
- }
66
- dependents.forEach((d) => this.disable(d, { cascade: true }));
67
- }
68
-
69
- this.active.delete(name);
70
- cleanup();
71
- }
72
-
73
- unregister(name: ModuleName): void {
74
- this.disable(name, { cascade: true });
75
- this.registry.delete(name);
76
- }
77
-
78
- /**
79
- * Enable module recursively
80
- *
81
- * @param name string
82
- * @param stack string[]
83
- * @returns void
84
- */
85
- private enableRec(name: ModuleName, stack: string[]): void {
86
- if (this.active.has(name)) return;
87
-
88
- if (stack.includes(name)) {
89
- throw new Error(`Circular dependency: ${[...stack, name].join(" -> ")}`);
90
- }
91
-
92
- const module = this.registry.get(name);
93
- if (!module) {
94
- const needer = stack[stack.length - 1];
95
- throw new Error(
96
- `Module "${name}" is not registered` + (needer ? ` (required by "${needer}")` : ""),
97
- );
98
- }
99
-
100
- //# enble deps
101
- for (const dep of module.requires ?? []) {
102
- this.enableRec(dep, [...stack, name]);
103
- }
104
-
105
- //# enable active module
106
- this.activate(module);
107
- }
108
-
109
- private activate(module: TModule): void {
110
- const { ctx, dispose } = ModuleUtils.createScopedTCtx(this.engine, module.name);
111
-
112
- try {
113
- const custom = module.install(ctx);
114
-
115
- this.active.set(module.name, () => {
116
- try {
117
- if (!custom) return;
118
- custom?.();
119
- } finally {
120
- dispose();
121
- }
122
- });
123
- } catch (error) {
124
- dispose();
125
- throw error;
126
- }
127
- }
128
-
129
- private activeDependentsOf(name: ModuleName): ModuleName[] {
130
- return [...this.active.keys()].filter((n) => this.registry.get(n)?.requires.includes(name));
131
- }
132
- }
@@ -1,174 +0,0 @@
1
- import type { BlockId, CoraxTree } from "../../base/types/tree/tree";
2
- import type { CommandMap } from "../../services/commandsbus/commandsbus";
3
- import type { StateMap } from "../../services/state";
4
- import type { SlotComponentMap, UIContext } from "../../services/ui";
5
- import { overlayPositionFromBlockRects, type EditorRect } from "../editor/editor.module";
6
- import type { BlockRect, TModule } from "../modules.types";
7
-
8
- export type SelectedBlocks = Map<BlockId, BlockRect>;
9
- type SelectMode = "replace" | "add" | "toggle" | "remove";
10
-
11
- declare module "../../services/commandsbus/commandsbus" {
12
- interface CommandMap {
13
- "blocks.select": {
14
- payload: { blocks: StateMap["selection"]["blocks"]; mode?: SelectMode };
15
- result: void;
16
- };
17
- "blocks.clearSelection": { payload: void; result: void };
18
- }
19
- }
20
-
21
- declare module "../../services/eventbus/eventbus" {
22
- interface TEventMap {
23
- "blocks:select": CommandMap["blocks.select"]["payload"];
24
- "selection:changed": {
25
- blocks: StateMap["selection"]["blocks"];
26
- previous: StateMap["selection"]["blocks"];
27
- };
28
- }
29
- }
30
-
31
- declare module "../../services/state/state" {
32
- interface StateMap {
33
- selection: { blocks: SelectedBlocks };
34
- }
35
- }
36
-
37
- declare module "../modules-manager" {
38
- interface ModuleMap {
39
- selection: {};
40
- }
41
- }
42
-
43
- declare module "../../services/ui/ui" {
44
- interface SlotComponentMap {
45
- SelectionOverlay: {
46
- position: {
47
- top: number;
48
- left: number;
49
- width: number;
50
- height: number;
51
- } | null;
52
- hidden: boolean;
53
- };
54
- }
55
-
56
- interface ComponentContributionIdentityMap {
57
- "selection-overlay": {};
58
- }
59
- }
60
-
61
- function compute(prev: SelectedBlocks, incoming: SelectedBlocks, mode: SelectMode): SelectedBlocks {
62
- switch (mode) {
63
- case "replace":
64
- return new Map(incoming);
65
-
66
- case "add":
67
- return new Map([...prev, ...incoming]);
68
-
69
- case "remove": {
70
- const result = new Map(prev);
71
- for (const id of incoming.keys()) {
72
- result.delete(id);
73
- }
74
- return result;
75
- }
76
-
77
- case "toggle": {
78
- const result = new Map(prev);
79
- for (const [id, rect] of incoming) {
80
- if (result.has(id)) {
81
- result.delete(id);
82
- } else {
83
- result.set(id, rect);
84
- }
85
- }
86
- return result;
87
- }
88
- }
89
- }
90
-
91
- function sameBlocks(a: SelectedBlocks, b: SelectedBlocks): boolean {
92
- if (a.size !== b.size) return false;
93
-
94
- for (const [id, rectA] of a.entries()) {
95
- const rectB = b.get(id);
96
- if (!rectB) return false;
97
-
98
- // Compare all BlockRect properties (shallow equality)
99
- for (const key in rectA) {
100
- if (Object.prototype.hasOwnProperty.call(rectA, key)) {
101
- if (rectA[key as keyof typeof rectA] !== rectB[key as keyof typeof rectB]) {
102
- return false;
103
- }
104
- }
105
- }
106
- }
107
-
108
- return true;
109
- }
110
-
111
- function selectionOverlayPropsFromUICtx(
112
- ui: UIContext,
113
- editorRect: EditorRect | null,
114
- order: CoraxTree["order"],
115
- ): SlotComponentMap["SelectionOverlay"]["position"] | null {
116
- const rects = Array.from(ui?.selection?.blocks?.entries() ?? [])
117
- .map(([id, rect]) => (order.has(id) ? rect : null))
118
- .filter(Boolean) as BlockRect[];
119
-
120
- return overlayPositionFromBlockRects(rects, editorRect);
121
- }
122
-
123
- export const SelectionModule: TModule = {
124
- name: "selection",
125
- version: "1.0.0",
126
- requires: [],
127
- install(ctx) {
128
- ctx.state.defineSlice("selection", { blocks: new Map() });
129
- ctx.ui.contribute("overlay", {
130
- id: "selection-overlay",
131
- slot: "overlay",
132
- order: 1000,
133
- kind: "component",
134
- name: "SelectionOverlay",
135
- when: (ui) => ui.selection!.blocks.size > 0,
136
- getProps: (ui) => {
137
- const editorState = ctx.state.get("editor") ?? { editorRect: null };
138
- const position = selectionOverlayPropsFromUICtx(
139
- ui,
140
- editorState?.editorRect,
141
- ctx.document.get().order,
142
- );
143
-
144
- return {
145
- position,
146
- hidden: !Array.from(ui.selection!.blocks.keys()).length || !position,
147
- };
148
- },
149
- });
150
-
151
- const apply = (next: SelectedBlocks) => {
152
- const previous = ctx.state.get("selection")!.blocks;
153
- if (sameBlocks(previous, next)) return;
154
-
155
- ctx.state.set("selection", { blocks: next });
156
- void ctx.events.emit("selection:changed", { blocks: next, previous });
157
- };
158
-
159
- ctx.commands.register("blocks.select", ({ blocks, mode = "replace" }) => {
160
- // Filter only blocks that exist in the document
161
- const validBlocks = new Map<BlockId, BlockRect>();
162
- for (const [id, rect] of blocks) {
163
- if (ctx.document.has(id)) {
164
- validBlocks.set(id, rect);
165
- }
166
- }
167
-
168
- const prev = ctx.state.get("selection")!.blocks;
169
- apply(compute(prev, validBlocks, mode));
170
- });
171
-
172
- ctx.commands.register("blocks.clearSelection", () => apply(new Map()));
173
- },
174
- };
@@ -1 +0,0 @@
1
- console.log("Selection test");
@@ -1,6 +0,0 @@
1
- import type { MarkAttrs, MarkType } from "../../services/text-marks";
2
-
3
- export const MARK_DEFAULT_ATTRS: Partial<Record<MarkType, MarkAttrs>> = {
4
- link: { href: "#" },
5
- initial: { style: { fontSize: 54 } },
6
- };