@prosekit/extensions 0.1.0 → 0.1.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.
@@ -252,6 +252,7 @@ toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
252
252
  toggleList: [attrs: ListAttributes];
253
253
  unwrapList: [options?: UnwrapListOptions | undefined];
254
254
  wrapInList: [getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)];
255
+ insertList: [attrs?: ListAttributes | undefined];
255
256
  };
256
257
  }>;
257
258
 
@@ -265,6 +266,7 @@ toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
265
266
  toggleList: [attrs: ListAttributes];
266
267
  unwrapList: [options?: UnwrapListOptions | undefined];
267
268
  wrapInList: [getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)];
269
+ insertList: [attrs?: ListAttributes | undefined];
268
270
  };
269
271
  }>;
270
272
 
@@ -303,6 +305,11 @@ NODES: "mention";
303
305
  */
304
306
  export declare function definePlaceholder(options: PlaceholderOptions): Extension<ExtensionTyping<string, string, CommandArgs>>;
305
307
 
308
+ /**
309
+ * Make the editor read-only.
310
+ */
311
+ export declare function defineReadonly(): Extension<ExtensionTyping<string, string, CommandArgs>>;
312
+
306
313
  /**
307
314
  * @public
308
315
  */
@@ -1,4 +1,4 @@
1
- /* ../../node_modules/.pnpm/prosemirror-flat-list@0.4.3/node_modules/prosemirror-flat-list/dist/style.css */
1
+ /* ../../node_modules/.pnpm/prosemirror-flat-list@0.4.5/node_modules/prosemirror-flat-list/dist/style.css */
2
2
  .prosemirror-flat-list {
3
3
  padding: 0;
4
4
  margin-top: 0;
@@ -25,25 +25,30 @@
25
25
  .prosemirror-flat-list[data-list-kind=bullet] {
26
26
  list-style: disc;
27
27
  }
28
+ .prosemirror-flat-list[data-list-kind=ordered] {
29
+ counter-increment: prosemirror-flat-list-counter;
30
+ }
31
+ .prosemirror-flat-list[data-list-kind=ordered] > * {
32
+ contain: style;
33
+ }
28
34
  .prosemirror-flat-list[data-list-kind=ordered]::before {
29
35
  position: absolute;
30
36
  right: 100%;
31
37
  font-variant-numeric: tabular-nums;
32
38
  content: counter(prosemirror-flat-list-counter, decimal) ". ";
33
39
  }
34
- @supports (-moz-appearance: none) {
35
- .prosemirror-flat-list[data-list-kind=ordered] {
36
- contain: style;
37
- counter-increment: prosemirror-flat-list-counter;
38
- }
40
+ .prosemirror-flat-list[data-list-kind=ordered]:first-child,
41
+ :not(.prosemirror-flat-list[data-list-kind=ordered]) + .prosemirror-flat-list[data-list-kind=ordered] {
42
+ counter-reset: prosemirror-flat-list-counter;
39
43
  }
40
- @supports not (-moz-appearance: none) {
41
- .prosemirror-flat-list[data-list-kind=ordered] {
42
- counter-reset: prosemirror-flat-list-counter;
43
- counter-increment: prosemirror-flat-list-counter;
44
+ @supports (counter-set: prosemirror-flat-list-counter 1) {
45
+ [data-list-order]:is(.prosemirror-flat-list[data-list-kind=ordered]:first-child, :not(.prosemirror-flat-list[data-list-kind=ordered]) + .prosemirror-flat-list[data-list-kind=ordered]) {
46
+ counter-set: prosemirror-flat-list-counter var(--prosemirror-flat-list-order);
44
47
  }
45
- .prosemirror-flat-list[data-list-kind=ordered] + .prosemirror-flat-list[data-list-kind=ordered] {
46
- counter-reset: none;
48
+ }
49
+ @supports not (counter-set: prosemirror-flat-list-counter 1) {
50
+ [data-list-order]:is(.prosemirror-flat-list[data-list-kind=ordered]:first-child, :not(.prosemirror-flat-list[data-list-kind=ordered]) + .prosemirror-flat-list[data-list-kind=ordered]) {
51
+ counter-increment: prosemirror-flat-list-counter var(--prosemirror-flat-list-order);
47
52
  }
48
53
  }
49
54
  .prosemirror-flat-list[data-list-kind=task] > .list-marker {
@@ -6,6 +6,7 @@ import {
6
6
  defineKeymap,
7
7
  defineNodeSpec,
8
8
  definePlugin,
9
+ insertNode,
9
10
  union,
10
11
  withPriority
11
12
  } from "@prosekit/core";
@@ -44,7 +45,10 @@ function defineListCommands() {
44
45
  toggleCollapsed: createToggleCollapsedCommand,
45
46
  toggleList: createToggleListCommand,
46
47
  unwrapList: createUnwrapListCommand,
47
- wrapInList: createWrapInListCommand
48
+ wrapInList: createWrapInListCommand,
49
+ insertList: (attrs) => {
50
+ return insertNode({ type: "list", attrs });
51
+ }
48
52
  });
49
53
  }
50
54
  function defineList() {
@@ -0,0 +1 @@
1
+ export { defineReadonly } from './_tsup-dts-rollup';
@@ -0,0 +1,16 @@
1
+ // src/readonly/index.ts
2
+ import { definePlugin } from "@prosekit/core";
3
+ import { PluginKey, ProseMirrorPlugin } from "@prosekit/pm/state";
4
+ function defineReadonly() {
5
+ return definePlugin(plugin);
6
+ }
7
+ var key = new PluginKey("readonly");
8
+ var plugin = new ProseMirrorPlugin({
9
+ key,
10
+ props: {
11
+ editable: () => false
12
+ }
13
+ });
14
+ export {
15
+ defineReadonly
16
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/extensions",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -96,6 +96,11 @@
96
96
  "./placeholder/style.css": {
97
97
  "default": "./dist/placeholder/style.css"
98
98
  },
99
+ "./readonly": {
100
+ "types": "./dist/prosekit-extensions-readonly.d.ts",
101
+ "import": "./dist/prosekit-extensions-readonly.js",
102
+ "default": "./dist/prosekit-extensions-readonly.js"
103
+ },
99
104
  "./strike": {
100
105
  "types": "./dist/prosekit-extensions-strike.d.ts",
101
106
  "import": "./dist/prosekit-extensions-strike.js",
@@ -119,13 +124,13 @@
119
124
  "@prosekit/core": "^0.1.0",
120
125
  "@prosekit/pm": "^0.1.0",
121
126
  "highlight.js": "^11.9.0",
122
- "prosemirror-flat-list": "^0.4.3",
127
+ "prosemirror-flat-list": "^0.4.5",
123
128
  "prosemirror-highlightjs": "^0.9.1"
124
129
  },
125
130
  "devDependencies": {
126
131
  "@prosekit/dev": "*",
127
- "tsup": "^7.2.0",
128
- "typescript": "^5.2.2",
132
+ "tsup": "^8.0.1",
133
+ "typescript": "^5.3.2",
129
134
  "vitest": "^0.34.6"
130
135
  },
131
136
  "scripts": {
@@ -174,6 +179,9 @@
174
179
  "placeholder": [
175
180
  "./dist/prosekit-extensions-placeholder.d.ts"
176
181
  ],
182
+ "readonly": [
183
+ "./dist/prosekit-extensions-readonly.d.ts"
184
+ ],
177
185
  "strike": [
178
186
  "./dist/prosekit-extensions-strike.d.ts"
179
187
  ],
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export {}