@milkdown/plugin-slash 4.10.5 → 4.12.0
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/README.md +50 -7
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +26 -14
- package/lib/config.js.map +1 -1
- package/lib/index.d.ts +14 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +14 -12
- package/lib/index.js.map +1 -1
- package/lib/item.d.ts +2 -1
- package/lib/item.d.ts.map +1 -1
- package/lib/item.js +1 -0
- package/lib/item.js.map +1 -1
- package/lib/prose-plugin/dropdown.d.ts +4 -0
- package/lib/prose-plugin/dropdown.d.ts.map +1 -0
- package/lib/prose-plugin/dropdown.js +39 -0
- package/lib/prose-plugin/dropdown.js.map +1 -0
- package/lib/prose-plugin/index.d.ts +7 -0
- package/lib/prose-plugin/index.d.ts.map +1 -0
- package/lib/prose-plugin/index.js +16 -0
- package/lib/prose-plugin/index.js.map +1 -0
- package/lib/prose-plugin/input.d.ts +15 -0
- package/lib/prose-plugin/input.d.ts.map +1 -0
- package/lib/prose-plugin/input.js +101 -0
- package/lib/prose-plugin/input.js.map +1 -0
- package/lib/prose-plugin/props.d.ts +10 -0
- package/lib/prose-plugin/props.d.ts.map +1 -0
- package/lib/prose-plugin/props.js +80 -0
- package/lib/prose-plugin/props.js.map +1 -0
- package/lib/prose-plugin/status.d.ts +20 -0
- package/lib/prose-plugin/status.d.ts.map +1 -0
- package/lib/prose-plugin/status.js +34 -0
- package/lib/prose-plugin/status.js.map +1 -0
- package/lib/prose-plugin/view.d.ts +12 -0
- package/lib/prose-plugin/view.d.ts.map +1 -0
- package/lib/prose-plugin/view.js +56 -0
- package/lib/prose-plugin/view.js.map +1 -0
- package/lib/style.d.ts +3 -0
- package/lib/style.d.ts.map +1 -0
- package/lib/style.js +62 -0
- package/lib/style.js.map +1 -0
- package/lib/utility.d.ts +7 -6
- package/lib/utility.d.ts.map +1 -1
- package/lib/utility.js +11 -63
- package/lib/utility.js.map +1 -1
- package/package.json +2 -2
- package/lib/slash-plugin.d.ts +0 -5
- package/lib/slash-plugin.d.ts.map +0 -1
- package/lib/slash-plugin.js +0 -298
- package/lib/slash-plugin.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,14 +8,57 @@ Add support for slash commands.
|
|
|
8
8
|
```typescript
|
|
9
9
|
import { Editor } from '@milkdown/core';
|
|
10
10
|
import { commonmark } from '@milkdown/preset-commonmark';
|
|
11
|
-
|
|
12
|
-
// import theme and style
|
|
13
|
-
import '@milkdown/theme-nord/lib/theme.css';
|
|
14
|
-
import '@milkdown/preset-commonmark/lib/style.css';
|
|
11
|
+
import { nord } from '@milkdown/theme-nord';
|
|
15
12
|
|
|
16
13
|
import { slash } from '@milkdown/plugin-slash';
|
|
17
|
-
// import style
|
|
18
|
-
import '@milkdown/plugin-slash/lib/style.css';
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
Editor.make().use(nord).use(commonmark).use(slash).create();
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
# Options
|
|
19
|
+
|
|
20
|
+
## config
|
|
21
|
+
|
|
22
|
+
Modify the list of slash plugin.
|
|
23
|
+
|
|
24
|
+
Example:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { slashPlugin, slash, createDropdownItem, config, nodeExists } from '@milkdown/plugin-slash';
|
|
28
|
+
|
|
29
|
+
Editor.make().use(
|
|
30
|
+
slash.configure(slashPlugin, {
|
|
31
|
+
config: (utils) =>
|
|
32
|
+
config(utils)
|
|
33
|
+
.filter((c) => !['h1', 'h2', 'h3'].includes(c.id))
|
|
34
|
+
.concat([
|
|
35
|
+
{
|
|
36
|
+
id: 'h1',
|
|
37
|
+
dom: createDropdownItem(utils.ctx.get(themeToolCtx), 'My Heading Tips', 'h1'),
|
|
38
|
+
command: () => utils.ctx.get(commandsCtx).call(TurnIntoHeading),
|
|
39
|
+
keyword: ['h1', 'my heading', 'heading'],
|
|
40
|
+
enable: nodeExists('heading'),
|
|
41
|
+
},
|
|
42
|
+
]),
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## placeholder
|
|
48
|
+
|
|
49
|
+
Modify the placeholder of slash plugin.
|
|
50
|
+
|
|
51
|
+
Example:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { slashPlugin, slash, CursorStatus } from '@milkdown/plugin-slash';
|
|
55
|
+
|
|
56
|
+
Editor.make().use(
|
|
57
|
+
slash.configure(slashPlugin, {
|
|
58
|
+
placeholder: {
|
|
59
|
+
[CursorStatus.Empty]: 'Now you need to type a / ...',
|
|
60
|
+
[CursorStatus.Slash]: 'Keep typing to search...',
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
21
64
|
```
|
package/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC;AAGrC,eAAO,MAAM,MAAM,EAAE,WA8EpB,CAAC"}
|
package/lib/config.js
CHANGED
|
@@ -1,69 +1,81 @@
|
|
|
1
|
-
|
|
1
|
+
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
|
+
import { commandsCtx, themeToolCtx } from '@milkdown/core';
|
|
3
|
+
import { InsertHr, InsertImage, InsertTable, TurnIntoCodeFence, TurnIntoHeading, TurnIntoTaskList, WrapInBlockquote, WrapInBulletList, WrapInOrderedList, } from '@milkdown/preset-gfm';
|
|
2
4
|
import { createDropdownItem, nodeExists } from './utility';
|
|
3
|
-
|
|
4
|
-
export const config = (ctx) => [
|
|
5
|
+
export const config = ({ ctx }) => [
|
|
5
6
|
{
|
|
6
|
-
|
|
7
|
+
id: 'h1',
|
|
8
|
+
dom: createDropdownItem(ctx.get(themeToolCtx), 'Large Heading', 'h1'),
|
|
7
9
|
command: () => ctx.get(commandsCtx).call(TurnIntoHeading, 1),
|
|
8
10
|
keyword: ['h1', 'large heading'],
|
|
9
11
|
enable: nodeExists('heading'),
|
|
10
12
|
},
|
|
11
13
|
{
|
|
12
|
-
|
|
14
|
+
id: 'h2',
|
|
15
|
+
dom: createDropdownItem(ctx.get(themeToolCtx), 'Medium Heading', 'h2'),
|
|
13
16
|
command: () => ctx.get(commandsCtx).call(TurnIntoHeading, 2),
|
|
14
17
|
keyword: ['h2', 'medium heading'],
|
|
15
18
|
enable: nodeExists('heading'),
|
|
16
19
|
},
|
|
17
20
|
{
|
|
18
|
-
|
|
21
|
+
id: 'h3',
|
|
22
|
+
dom: createDropdownItem(ctx.get(themeToolCtx), 'Small Heading', 'h3'),
|
|
19
23
|
command: () => ctx.get(commandsCtx).call(TurnIntoHeading, 3),
|
|
20
24
|
keyword: ['h3', 'small heading'],
|
|
21
25
|
enable: nodeExists('heading'),
|
|
22
26
|
},
|
|
23
27
|
{
|
|
24
|
-
|
|
28
|
+
id: 'bulletList',
|
|
29
|
+
dom: createDropdownItem(ctx.get(themeToolCtx), 'Bullet List', 'bulletList'),
|
|
25
30
|
command: () => ctx.get(commandsCtx).call(WrapInBulletList),
|
|
26
31
|
keyword: ['bullet list', 'ul'],
|
|
27
32
|
enable: nodeExists('bullet_list'),
|
|
28
33
|
},
|
|
29
34
|
{
|
|
30
|
-
|
|
35
|
+
id: 'orderedList',
|
|
36
|
+
dom: createDropdownItem(ctx.get(themeToolCtx), 'Ordered List', 'orderedList'),
|
|
31
37
|
command: () => ctx.get(commandsCtx).call(WrapInOrderedList),
|
|
32
38
|
keyword: ['ordered list', 'ol'],
|
|
33
39
|
enable: nodeExists('ordered_list'),
|
|
34
40
|
},
|
|
35
41
|
{
|
|
36
|
-
|
|
42
|
+
id: 'taskList',
|
|
43
|
+
dom: createDropdownItem(ctx.get(themeToolCtx), 'Task List', 'taskList'),
|
|
37
44
|
command: () => ctx.get(commandsCtx).call(TurnIntoTaskList),
|
|
38
45
|
keyword: ['task list', 'task'],
|
|
39
46
|
enable: nodeExists('task_list_item'),
|
|
40
47
|
},
|
|
41
48
|
{
|
|
42
|
-
|
|
49
|
+
id: 'image',
|
|
50
|
+
dom: createDropdownItem(ctx.get(themeToolCtx), 'Image', 'image'),
|
|
43
51
|
command: () => ctx.get(commandsCtx).call(InsertImage),
|
|
44
52
|
keyword: ['image'],
|
|
45
53
|
enable: nodeExists('image'),
|
|
46
54
|
},
|
|
47
55
|
{
|
|
48
|
-
|
|
56
|
+
id: 'blockquote',
|
|
57
|
+
dom: createDropdownItem(ctx.get(themeToolCtx), 'Quote', 'quote'),
|
|
49
58
|
command: () => ctx.get(commandsCtx).call(WrapInBlockquote),
|
|
50
59
|
keyword: ['quote', 'blockquote'],
|
|
51
60
|
enable: nodeExists('blockquote'),
|
|
52
61
|
},
|
|
53
62
|
{
|
|
54
|
-
|
|
63
|
+
id: 'table',
|
|
64
|
+
dom: createDropdownItem(ctx.get(themeToolCtx), 'Table', 'table'),
|
|
55
65
|
command: () => ctx.get(commandsCtx).call(InsertTable),
|
|
56
66
|
keyword: ['table'],
|
|
57
67
|
enable: nodeExists('table'),
|
|
58
68
|
},
|
|
59
69
|
{
|
|
60
|
-
|
|
70
|
+
id: 'code',
|
|
71
|
+
dom: createDropdownItem(ctx.get(themeToolCtx), 'Code Fence', 'code'),
|
|
61
72
|
command: () => ctx.get(commandsCtx).call(TurnIntoCodeFence),
|
|
62
73
|
keyword: ['code'],
|
|
63
74
|
enable: nodeExists('fence'),
|
|
64
75
|
},
|
|
65
76
|
{
|
|
66
|
-
|
|
77
|
+
id: 'divider',
|
|
78
|
+
dom: createDropdownItem(ctx.get(themeToolCtx), 'Divide Line', 'divider'),
|
|
67
79
|
command: () => ctx.get(commandsCtx).call(InsertHr),
|
|
68
80
|
keyword: ['divider', 'hr'],
|
|
69
81
|
enable: nodeExists('hr'),
|
package/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EACH,QAAQ,EACR,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GACpB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE3D,MAAM,CAAC,MAAM,MAAM,GAAgB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IAC5C;QACI,EAAE,EAAE,IAAI;QACR,GAAG,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC;QACrE,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QAC5D,OAAO,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC;QAChC,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC;KAChC;IACD;QACI,EAAE,EAAE,IAAI;QACR,GAAG,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,gBAAgB,EAAE,IAAI,CAAC;QACtE,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAA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AAC,YAAY,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC;QACpE,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC;QAC3D,OAAO,EAAE,CAAC,MAAM,CAAC;QACjB,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC;KAC9B;IACD;QACI,EAAE,EAAE,SAAS;QACb,GAAG,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,aAAa,EAAE,SAAS,CAAC;QACxE,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;QAClD,OAAO,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;QAC1B,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC;KAC3B;CACJ,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AtomList, Utils } from '@milkdown/utils';
|
|
2
2
|
import { WrappedAction } from './item';
|
|
3
|
+
import { CursorStatus } from './prose-plugin/status';
|
|
4
|
+
export { config } from './config';
|
|
5
|
+
export { CursorStatus } from './prose-plugin/status';
|
|
3
6
|
export { createDropdownItem, nodeExists } from './utility';
|
|
4
|
-
export declare type SlashConfig = (
|
|
5
|
-
export declare
|
|
6
|
-
|
|
7
|
+
export declare type SlashConfig = (utils: Utils) => WrappedAction[];
|
|
8
|
+
export declare type Options = {
|
|
9
|
+
config: SlashConfig;
|
|
10
|
+
placeholder: {
|
|
11
|
+
[CursorStatus.Empty]: string;
|
|
12
|
+
[CursorStatus.Slash]: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const slashPlugin: import("@milkdown/utils/lib/atom/types").Origin<string, Options, import("prosemirror-state").Plugin<any, any>>;
|
|
16
|
+
export declare const slash: AtomList<import("@milkdown/utils/lib/atom/types").PluginWithMetadata<string, Options, import("prosemirror-state").Plugin<any, any>>>;
|
|
7
17
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAqB,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAGrE,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE3D,oBAAY,WAAW,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,aAAa,EAAE,CAAC;AAE5D,oBAAY,OAAO,GAAG;IAClB,MAAM,EAAE,WAAW,CAAC;IACpB,WAAW,EAAE;QACT,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAC7B,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;KAChC,CAAC;CACL,CAAC;AACF,eAAO,MAAM,WAAW,gHAUtB,CAAC;AAEH,eAAO,MAAM,KAAK,sIAAmC,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
|
+
import { AtomList, createProsePlugin } from '@milkdown/utils';
|
|
3
3
|
import { config } from './config';
|
|
4
|
-
import {
|
|
4
|
+
import { createSlashPlugin } from './prose-plugin';
|
|
5
|
+
import { CursorStatus } from './prose-plugin/status';
|
|
6
|
+
export { config } from './config';
|
|
7
|
+
export { CursorStatus } from './prose-plugin/status';
|
|
5
8
|
export { createDropdownItem, nodeExists } from './utility';
|
|
6
|
-
export const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
9
|
+
export const slashPlugin = createProsePlugin((options, utils) => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const slashConfig = (_a = options === null || options === void 0 ? void 0 : options.config) !== null && _a !== void 0 ? _a : config;
|
|
12
|
+
const placeholder = Object.assign({ [CursorStatus.Empty]: 'Type / to use the slash commands...', [CursorStatus.Slash]: 'Type to filter...' }, ((_b = options === null || options === void 0 ? void 0 : options.placeholder) !== null && _b !== void 0 ? _b : {}));
|
|
13
|
+
const cfg = slashConfig(utils);
|
|
14
|
+
return createSlashPlugin(utils, cfg, placeholder);
|
|
15
|
+
});
|
|
16
|
+
export const slash = AtomList.create([slashPlugin()]);
|
|
15
17
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAS,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAW3D,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAU,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;;IACrE,MAAM,WAAW,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,mCAAI,MAAM,CAAC;IAC9C,MAAM,WAAW,mBACb,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,qCAAqC,EAC3D,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,mBAAmB,IACtC,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,mCAAI,EAAE,CAAC,CAClC,CAAC;IACF,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAE/B,OAAO,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC"}
|
package/lib/item.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Command } from 'prosemirror-commands';
|
|
2
2
|
import type { Schema } from 'prosemirror-model';
|
|
3
3
|
export declare type Action = {
|
|
4
|
+
id: string;
|
|
4
5
|
$: HTMLElement;
|
|
5
6
|
keyword: string[];
|
|
6
7
|
command: Command;
|
|
7
8
|
enable: (schema: Schema) => boolean;
|
|
8
9
|
};
|
|
9
|
-
export declare type WrappedAction = Pick<Action, 'keyword'> & {
|
|
10
|
+
export declare type WrappedAction = Pick<Action, 'keyword' | 'id'> & {
|
|
10
11
|
enable: (schema: Schema) => boolean;
|
|
11
12
|
command: () => void;
|
|
12
13
|
dom: HTMLElement;
|
package/lib/item.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../src/item.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../src/item.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAIhD,oBAAY,MAAM,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,WAAW,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;CACvC,CAAC;AAEF,oBAAY,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC,GAAG;IACzD,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IACpC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,GAAG,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,aAAa,KAAG,MAMtD,CAAC"}
|
package/lib/item.js
CHANGED
package/lib/item.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.js","sourceRoot":"","sources":["../src/item.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"item.js","sourceRoot":"","sources":["../src/item.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAgBjD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAqB,EAAU,EAAE,CAAC,CAAC;IAC/D,EAAE,EAAE,MAAM,CAAC,EAAE;IACb,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,CAAC,EAAE,MAAM,CAAC,GAAG;IACb,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC,MAAM;CACxB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../src/prose-plugin/dropdown.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,cAAc,WAAY,MAAM,mBAAmB,WAAW,SAAS,MAAM,EAAE,KAAG,OA0C9F,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
|
+
import scrollIntoView from 'smooth-scroll-into-view-if-needed';
|
|
3
|
+
export const renderDropdown = (status, dropdownElement, items) => {
|
|
4
|
+
const { filter } = status.get();
|
|
5
|
+
if (!status.isSlash()) {
|
|
6
|
+
dropdownElement.classList.add('hide');
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
const activeList = items
|
|
10
|
+
.filter((item) => {
|
|
11
|
+
item.$.classList.remove('active');
|
|
12
|
+
const result = item.keyword.some((key) => key.includes(filter.toLocaleLowerCase()));
|
|
13
|
+
if (result) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
item.$.classList.add('hide');
|
|
17
|
+
return false;
|
|
18
|
+
})
|
|
19
|
+
.map((item) => {
|
|
20
|
+
item.$.classList.remove('hide');
|
|
21
|
+
return item;
|
|
22
|
+
});
|
|
23
|
+
status.setActions(activeList);
|
|
24
|
+
if (activeList.length === 0) {
|
|
25
|
+
dropdownElement.classList.add('hide');
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
dropdownElement.classList.remove('hide');
|
|
29
|
+
activeList[0].$.classList.add('active');
|
|
30
|
+
requestAnimationFrame(() => {
|
|
31
|
+
scrollIntoView(activeList[0].$, {
|
|
32
|
+
scrollMode: 'if-needed',
|
|
33
|
+
block: 'nearest',
|
|
34
|
+
inline: 'nearest',
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
return true;
|
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zB,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,KAAK,CAAC;KAChB;IAED,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEzC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxC,qBAAqB,CAAC,GAAG,EAAE;QACvB,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YAC5B,UAAU,EAAE,WAAW;YACvB,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,SAAS;SACpB,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Utils } from '@milkdown/utils';
|
|
2
|
+
import { Plugin } from 'prosemirror-state';
|
|
3
|
+
import { WrappedAction } from '../item';
|
|
4
|
+
import { CursorStatus } from './status';
|
|
5
|
+
export declare const key = "MILKDOWN_PLUGIN_SLASH";
|
|
6
|
+
export declare const createSlashPlugin: (utils: Utils, items: WrappedAction[], placeholder: Record<CursorStatus, string>) => Plugin<any, any>;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prose-plugin/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAa,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAmB,aAAa,EAAE,MAAM,SAAS,CAAC;AAEzD,OAAO,EAAgB,YAAY,EAAE,MAAM,UAAU,CAAC;AAGtD,eAAO,MAAM,GAAG,0BAA0B,CAAC;AAE3C,eAAO,MAAM,iBAAiB,UAAW,KAAK,SAAS,aAAa,EAAE,eAAe,OAAO,YAAY,EAAE,MAAM,CAAC,qBAShH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
2
|
+
import { transformAction } from '../item';
|
|
3
|
+
import { createProps } from './props';
|
|
4
|
+
import { createStatus } from './status';
|
|
5
|
+
import { createView } from './view';
|
|
6
|
+
export const key = 'MILKDOWN_PLUGIN_SLASH';
|
|
7
|
+
export const createSlashPlugin = (utils, items, placeholder) => {
|
|
8
|
+
const status = createStatus();
|
|
9
|
+
const actions = items.map(transformAction);
|
|
10
|
+
return new Plugin({
|
|
11
|
+
key: new PluginKey(key),
|
|
12
|
+
props: createProps(status, utils, placeholder),
|
|
13
|
+
view: (view) => createView(status, actions, view, utils),
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prose-plugin/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAiB,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,YAAY,EAAgB,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,CAAC,MAAM,GAAG,GAAG,uBAAuB,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAY,EAAE,KAAsB,EAAE,WAAyC,EAAE,EAAE;IACjH,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAE3C,OAAO,IAAI,MAAM,CAAC;QACd,GAAG,EAAE,IAAI,SAAS,CAAC,GAAG,CAAC;QACvB,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC;QAC9C,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC;KAC3D,CAAC,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
import { Action } from '../item';
|
|
3
|
+
import { Status } from './status';
|
|
4
|
+
export declare const createMouseManager: () => {
|
|
5
|
+
isLock: () => boolean;
|
|
6
|
+
lock: () => void;
|
|
7
|
+
unlock: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare type MouseManager = ReturnType<typeof createMouseManager>;
|
|
10
|
+
export declare const handleMouseMove: (mouseManager: MouseManager) => () => void;
|
|
11
|
+
export declare const handleMouseEnter: (status: Status, mouseManager: MouseManager) => (e: MouseEvent) => void;
|
|
12
|
+
export declare const handleMouseLeave: () => (e: MouseEvent) => void;
|
|
13
|
+
export declare const handleClick: (status: Status, items: Action[], view: EditorView, dropdownElement: HTMLElement) => (e: Event) => void;
|
|
14
|
+
export declare const handleKeydown: (status: Status, view: EditorView, dropdownElement: HTMLElement, mouseManager: MouseManager) => (e: Event) => void;
|
|
15
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/prose-plugin/input.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,kBAAkB;;;;CAY9B,CAAC;AACF,oBAAY,YAAY,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEjE,eAAO,MAAM,eAAe,iBAAkB,YAAY,eAEzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,MAAM,gBAAgB,YAAY,SAAS,UAAU,SAS7F,CAAC;AAEF,eAAO,MAAM,gBAAgB,YAAa,UAAU,SAInD,CAAC;AAEF,eAAO,MAAM,WAAW,WACX,MAAM,SAAS,MAAM,EAAE,QAAQ,UAAU,mBAAmB,WAAW,SAC5E,KAAK,KAAG,IAuBX,CAAC;AAEN,eAAO,MAAM,aAAa,WACb,MAAM,QAAQ,UAAU,mBAAmB,WAAW,gBAAgB,YAAY,SAAS,KAAK,SA+CxG,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
|
+
import scrollIntoView from 'smooth-scroll-into-view-if-needed';
|
|
3
|
+
export const createMouseManager = () => {
|
|
4
|
+
let mouseLock = false;
|
|
5
|
+
return {
|
|
6
|
+
isLock: () => mouseLock,
|
|
7
|
+
lock: () => {
|
|
8
|
+
mouseLock = true;
|
|
9
|
+
},
|
|
10
|
+
unlock: () => {
|
|
11
|
+
mouseLock = false;
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export const handleMouseMove = (mouseManager) => () => {
|
|
16
|
+
mouseManager.unlock();
|
|
17
|
+
};
|
|
18
|
+
export const handleMouseEnter = (status, mouseManager) => (e) => {
|
|
19
|
+
if (mouseManager.isLock())
|
|
20
|
+
return;
|
|
21
|
+
const active = status.get().activeActions.findIndex((x) => x.$.classList.contains('active'));
|
|
22
|
+
if (active >= 0) {
|
|
23
|
+
status.get().activeActions[active].$.classList.remove('active');
|
|
24
|
+
}
|
|
25
|
+
const { target } = e;
|
|
26
|
+
if (!(target instanceof HTMLElement))
|
|
27
|
+
return;
|
|
28
|
+
target.classList.add('active');
|
|
29
|
+
};
|
|
30
|
+
export const handleMouseLeave = () => (e) => {
|
|
31
|
+
const { target } = e;
|
|
32
|
+
if (!(target instanceof HTMLElement))
|
|
33
|
+
return;
|
|
34
|
+
target.classList.remove('active');
|
|
35
|
+
};
|
|
36
|
+
export const handleClick = (status, items, view, dropdownElement) => (e) => {
|
|
37
|
+
const { target } = e;
|
|
38
|
+
if (!(target instanceof HTMLElement))
|
|
39
|
+
return;
|
|
40
|
+
if (!view)
|
|
41
|
+
return;
|
|
42
|
+
const stop = () => {
|
|
43
|
+
e.stopPropagation();
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
};
|
|
46
|
+
const el = Object.values(items).find(({ $ }) => $.contains(target));
|
|
47
|
+
if (!el) {
|
|
48
|
+
if (status.isEmpty())
|
|
49
|
+
return;
|
|
50
|
+
status.clearStatus();
|
|
51
|
+
dropdownElement.classList.add('hide');
|
|
52
|
+
stop();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
stop();
|
|
56
|
+
el.command(view.state, view.dispatch, view);
|
|
57
|
+
};
|
|
58
|
+
export const handleKeydown = (status, view, dropdownElement, mouseManager) => (e) => {
|
|
59
|
+
if (!(e instanceof KeyboardEvent))
|
|
60
|
+
return;
|
|
61
|
+
if (!mouseManager.isLock())
|
|
62
|
+
mouseManager.lock();
|
|
63
|
+
const { key } = e;
|
|
64
|
+
if (!status.isSlash())
|
|
65
|
+
return;
|
|
66
|
+
if (!['ArrowDown', 'ArrowUp', 'Enter', 'Escape'].includes(key))
|
|
67
|
+
return;
|
|
68
|
+
const { activeActions } = status.get();
|
|
69
|
+
let active = activeActions.findIndex(({ $ }) => $.classList.contains('active'));
|
|
70
|
+
if (active < 0)
|
|
71
|
+
active = 0;
|
|
72
|
+
const moveActive = (next) => {
|
|
73
|
+
activeActions[active].$.classList.remove('active');
|
|
74
|
+
activeActions[next].$.classList.add('active');
|
|
75
|
+
scrollIntoView(activeActions[next].$, {
|
|
76
|
+
scrollMode: 'if-needed',
|
|
77
|
+
block: 'nearest',
|
|
78
|
+
inline: 'nearest',
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
if (key === 'ArrowDown') {
|
|
82
|
+
const next = active === activeActions.length - 1 ? 0 : active + 1;
|
|
83
|
+
moveActive(next);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (key === 'ArrowUp') {
|
|
87
|
+
const next = active === 0 ? activeActions.length - 1 : active - 1;
|
|
88
|
+
moveActive(next);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (key === 'Escape') {
|
|
92
|
+
if (status.isEmpty())
|
|
93
|
+
return;
|
|
94
|
+
status.clearStatus();
|
|
95
|
+
dropdownElement.classList.add('hide');
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
activeActions[active].command(view.state, view.dispatch, view);
|
|
99
|
+
activeActions[active].$.classList.remove('active');
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=input.js.map
|