@milkdown/preset-gfm 6.3.0 → 6.3.1
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/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.es.js +173 -192
- package/lib/index.es.js.map +1 -1
- package/lib/table/nodes/index.d.ts +0 -2
- package/lib/table/nodes/index.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +1 -1
- package/src/table/nodes/index.ts +2 -30
- package/src/table/operator-plugin/style.ts +12 -12
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PluginKey } from '@milkdown/prose/state';
|
|
2
1
|
export declare const SupportedKeys: {
|
|
3
2
|
readonly NextCell: "NextCell";
|
|
4
3
|
readonly PrevCell: "PrevCell";
|
|
@@ -9,6 +8,5 @@ export declare const PrevCell: import("@milkdown/core").CmdKey<undefined>;
|
|
|
9
8
|
export declare const NextCell: import("@milkdown/core").CmdKey<undefined>;
|
|
10
9
|
export declare const BreakTable: import("@milkdown/core").CmdKey<undefined>;
|
|
11
10
|
export declare const InsertTable: import("@milkdown/core").CmdKey<undefined>;
|
|
12
|
-
export declare const TableContentFilterPluginKey: PluginKey<any>;
|
|
13
11
|
export declare const table: import("@milkdown/utils").WithExtend<"NextCell" | "PrevCell" | "ExitTable", Record<string, unknown>, import("@milkdown/utils").TypeMapping<"table" | "table_row" | "table_cell" | "table_header", string>, import("@milkdown/utils").PluginRest<"table" | "table_row" | "table_cell" | "table_header", string>>;
|
|
14
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/nodes/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/nodes/index.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AACX,oBAAY,aAAa,GAAG,OAAO,aAAa,CAAC;AAIjD,eAAO,MAAM,QAAQ,4CAA2B,CAAC;AACjD,eAAO,MAAM,QAAQ,4CAA2B,CAAC;AACjD,eAAO,MAAM,UAAU,4CAA6B,CAAC;AACrD,eAAO,MAAM,WAAW,4CAA8B,CAAC;AAEvD,eAAO,MAAM,KAAK,iTA8IhB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milkdown/preset-gfm",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.es.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"gfm"
|
|
18
18
|
],
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@milkdown/core": "6.3.
|
|
21
|
-
"@milkdown/design-system": "6.3.
|
|
22
|
-
"@milkdown/preset-commonmark": "6.3.
|
|
23
|
-
"@milkdown/prose": "6.3.
|
|
20
|
+
"@milkdown/core": "6.3.1",
|
|
21
|
+
"@milkdown/design-system": "6.3.1",
|
|
22
|
+
"@milkdown/preset-commonmark": "6.3.1",
|
|
23
|
+
"@milkdown/prose": "6.3.1"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@milkdown/core": "^6.0.1",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@milkdown/prose": "^6.0.1"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@milkdown/utils": "6.3.
|
|
32
|
-
"@milkdown/exception": "6.3.
|
|
31
|
+
"@milkdown/utils": "6.3.1",
|
|
32
|
+
"@milkdown/exception": "6.3.1",
|
|
33
33
|
"remark-gfm": "^3.0.0",
|
|
34
34
|
"tslib": "^2.4.0"
|
|
35
35
|
},
|
package/src/index.ts
CHANGED
package/src/table/nodes/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createCmd, createCmdKey, MarkdownNode, schemaCtx } from '@milkdown/core';
|
|
3
3
|
import { InputRule } from '@milkdown/prose/inputrules';
|
|
4
4
|
import { NodeType } from '@milkdown/prose/model';
|
|
5
|
-
import {
|
|
5
|
+
import { Selection, TextSelection } from '@milkdown/prose/state';
|
|
6
6
|
import { createPlugin, createShortcut } from '@milkdown/utils';
|
|
7
7
|
|
|
8
8
|
import { exitTable } from '../command';
|
|
@@ -28,8 +28,6 @@ export const NextCell = createCmdKey('NextCell');
|
|
|
28
28
|
export const BreakTable = createCmdKey('BreakTable');
|
|
29
29
|
export const InsertTable = createCmdKey('InsertTable');
|
|
30
30
|
|
|
31
|
-
export const TableContentFilterPluginKey = new PluginKey('MILKDOWN_TABLE_CONTENT_FILTER');
|
|
32
|
-
|
|
33
31
|
export const table = createPlugin<Keys, Record<string, unknown>, keyof typeof schema>((utils) => {
|
|
34
32
|
return {
|
|
35
33
|
schema: () => ({
|
|
@@ -169,33 +167,7 @@ export const table = createPlugin<Keys, Record<string, unknown>, keyof typeof sc
|
|
|
169
167
|
[SupportedKeys.ExitTable]: createShortcut(BreakTable, 'Mod-Enter'),
|
|
170
168
|
},
|
|
171
169
|
prosePlugins: (_, ctx) => {
|
|
172
|
-
return [
|
|
173
|
-
operatorPlugin(ctx, utils),
|
|
174
|
-
autoInsertZeroSpace(),
|
|
175
|
-
columnResizing(),
|
|
176
|
-
tableEditing(),
|
|
177
|
-
new Plugin({
|
|
178
|
-
key: TableContentFilterPluginKey,
|
|
179
|
-
filterTransaction: (tr, state) => {
|
|
180
|
-
const isInsertHr = tr.getMeta('hardbreak');
|
|
181
|
-
const [step] = tr.steps;
|
|
182
|
-
if (isInsertHr && step) {
|
|
183
|
-
const { from } = step as unknown as { from: number };
|
|
184
|
-
const $from = state.doc.resolve(from);
|
|
185
|
-
let curDepth = $from.depth;
|
|
186
|
-
let canApply = true;
|
|
187
|
-
while (curDepth > 0) {
|
|
188
|
-
if ($from.node(curDepth).type.name === 'table') {
|
|
189
|
-
canApply = false;
|
|
190
|
-
}
|
|
191
|
-
curDepth--;
|
|
192
|
-
}
|
|
193
|
-
return canApply;
|
|
194
|
-
}
|
|
195
|
-
return true;
|
|
196
|
-
},
|
|
197
|
-
}),
|
|
198
|
-
];
|
|
170
|
+
return [operatorPlugin(ctx, utils), autoInsertZeroSpace(), columnResizing(), tableEditing()];
|
|
199
171
|
},
|
|
200
172
|
};
|
|
201
173
|
});
|
|
@@ -10,8 +10,8 @@ export const injectStyle = (themeManager: ThemeManager, { css, injectGlobal }: E
|
|
|
10
10
|
.milkdown {
|
|
11
11
|
.tableWrapper {
|
|
12
12
|
table {
|
|
13
|
-
width: calc(100% -
|
|
14
|
-
margin:
|
|
13
|
+
width: calc(100% - 32px) !important;
|
|
14
|
+
margin: 16px 0 16px 16px !important;
|
|
15
15
|
|
|
16
16
|
.milkdown-cell-left,
|
|
17
17
|
.milkdown-cell-point,
|
|
@@ -37,24 +37,24 @@ export const injectStyle = (themeManager: ThemeManager, { css, injectGlobal }: E
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
.milkdown-cell-left {
|
|
40
|
-
left:
|
|
40
|
+
left: -14px;
|
|
41
41
|
top: 0;
|
|
42
42
|
bottom: 0;
|
|
43
|
-
width:
|
|
43
|
+
width: 8px;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
.milkdown-cell-top {
|
|
47
47
|
left: 0;
|
|
48
48
|
right: 0;
|
|
49
|
-
top:
|
|
50
|
-
height:
|
|
49
|
+
top: -14px;
|
|
50
|
+
height: 8px;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.milkdown-cell-point {
|
|
54
|
-
left:
|
|
55
|
-
top:
|
|
56
|
-
width:
|
|
57
|
-
height:
|
|
54
|
+
left: -18px;
|
|
55
|
+
top: -18px;
|
|
56
|
+
width: 16px;
|
|
57
|
+
height: 16px;
|
|
58
58
|
|
|
59
59
|
.icon {
|
|
60
60
|
position: absolute;
|
|
@@ -90,8 +90,8 @@ export const injectStyle = (themeManager: ThemeManager, { css, injectGlobal }: E
|
|
|
90
90
|
position: relative;
|
|
91
91
|
color: ${palette('solid', 0.87)};
|
|
92
92
|
|
|
93
|
-
width:
|
|
94
|
-
line-height:
|
|
93
|
+
width: 48px;
|
|
94
|
+
line-height: 48px;
|
|
95
95
|
text-align: center;
|
|
96
96
|
transition: all 0.4s ease-in-out;
|
|
97
97
|
|