@jvs-milkdown/crepe 1.2.26 → 1.2.27
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/cjs/feature/block-edit/index.js +3 -3
- package/lib/cjs/feature/block-edit/index.js.map +1 -1
- package/lib/cjs/feature/toolbar/index.js +1 -1
- package/lib/cjs/feature/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +16 -4
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/feature/block-edit/index.js +3 -3
- package/lib/esm/feature/block-edit/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js +1 -1
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +16 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/theme/common/block-edit.css +5 -3
- package/lib/theme/common/code-mirror.css +19 -0
- package/lib/theme/common/link-tooltip.css +2 -2
- package/lib/theme/common/toolbar.css +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/default-config/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/handle/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/component.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/default-config/index.ts +17 -1
- package/src/feature/block-edit/handle/index.ts +8 -2
- package/src/feature/block-edit/menu/component.tsx +4 -1
- package/src/theme/common/block-edit.css +5 -3
- package/src/theme/common/code-mirror.css +19 -0
- package/src/theme/common/link-tooltip.css +2 -2
- package/src/theme/common/toolbar.css +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/default-config/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/default-config/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAwBlE,eAAO,MAAM,aAAa,EAAE,kBAU3B,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,YAAY,OAAO,CAAC,kBAAkB,CAAC,qDAOlE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/feature/block-edit/handle/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAehD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/feature/block-edit/handle/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAehD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAwRtD,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,GAAG,EACR,MAAM,CAAC,EAAE,sBAAsB,QA2ChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../../src/feature/block-edit/menu/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAYhD,OAAO,EAOL,KAAK,GAAG,EAGT,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,IAAI,CAAA;AAwBhD,KAAK,SAAS,GAAG;IACf,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAClB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACnB,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,MAAM,CAAC,EAAE,sBAAsB,CAAA;IAC/B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../../src/feature/block-edit/menu/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAYhD,OAAO,EAOL,KAAK,GAAG,EAGT,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,IAAI,CAAA;AAwBhD,KAAK,SAAS,GAAG;IACf,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAClB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACnB,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,MAAM,CAAC,EAAE,sBAAsB,CAAA;IAC/B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,IAAI,oWAuxCf,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jvs-milkdown/crepe",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.27",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"crepe",
|
|
6
6
|
"editor",
|
|
@@ -107,9 +107,9 @@
|
|
|
107
107
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
108
108
|
"@codemirror/view": "^6.26.0",
|
|
109
109
|
"@floating-ui/dom": "^1.7.6",
|
|
110
|
-
"@jvs-milkdown/kit": "^1.2.
|
|
111
|
-
"@jvs-milkdown/prose": "^1.2.
|
|
112
|
-
"@jvs-milkdown/utils": "^1.2.
|
|
110
|
+
"@jvs-milkdown/kit": "^1.2.27",
|
|
111
|
+
"@jvs-milkdown/prose": "^1.2.27",
|
|
112
|
+
"@jvs-milkdown/utils": "^1.2.27",
|
|
113
113
|
"@types/lodash-es": "^4.17.12",
|
|
114
114
|
"clsx": "^2.0.0",
|
|
115
115
|
"codemirror": "^6.0.1",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LanguageDescription } from '@codemirror/language'
|
|
1
2
|
import { languages } from '@codemirror/language-data'
|
|
2
3
|
import { oneDark } from '@codemirror/theme-one-dark'
|
|
3
4
|
import { mergeWith } from 'lodash-es'
|
|
@@ -11,10 +12,25 @@ import {
|
|
|
11
12
|
visibilityOffIcon,
|
|
12
13
|
} from '../icons'
|
|
13
14
|
|
|
15
|
+
const mermaidLanguage = LanguageDescription.of({
|
|
16
|
+
name: 'Mermaid',
|
|
17
|
+
alias: ['mermaid'],
|
|
18
|
+
load: () => {
|
|
19
|
+
const fallback =
|
|
20
|
+
languages.find((l) => l.name === 'YAML') ||
|
|
21
|
+
languages.find((l) => l.name === 'Markdown')
|
|
22
|
+
return fallback ? fallback.load() : Promise.resolve(null as any)
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const allLanguages = [mermaidLanguage, ...languages].sort((a, b) =>
|
|
27
|
+
a.name.localeCompare(b.name)
|
|
28
|
+
)
|
|
29
|
+
|
|
14
30
|
export const defaultConfig: CrepeFeatureConfig = {
|
|
15
31
|
[CrepeFeature.CodeMirror]: {
|
|
16
32
|
theme: oneDark,
|
|
17
|
-
languages,
|
|
33
|
+
languages: allLanguages,
|
|
18
34
|
expandIcon: chevronDownIcon,
|
|
19
35
|
searchIcon: searchIcon,
|
|
20
36
|
clearSearchIcon: clearIcon,
|
|
@@ -96,7 +96,10 @@ class BlockHandleView implements PluginView {
|
|
|
96
96
|
node.type.name.includes('math') ||
|
|
97
97
|
hasMediaChild
|
|
98
98
|
const isEmpty =
|
|
99
|
-
node.
|
|
99
|
+
node.type.name === 'paragraph' &&
|
|
100
|
+
node.textContent.length === 0 &&
|
|
101
|
+
node.content.size <= 2 &&
|
|
102
|
+
!isMedia
|
|
100
103
|
if (isEmpty) {
|
|
101
104
|
this.#content.classList.add('empty-block')
|
|
102
105
|
} else {
|
|
@@ -158,7 +161,10 @@ class BlockHandleView implements PluginView {
|
|
|
158
161
|
node.type.name.includes('math') ||
|
|
159
162
|
hasMediaChild
|
|
160
163
|
const isEmpty =
|
|
161
|
-
node.
|
|
164
|
+
node.type.name === 'paragraph' &&
|
|
165
|
+
node.textContent.length === 0 &&
|
|
166
|
+
node.content.size <= 2 &&
|
|
167
|
+
!isMedia
|
|
162
168
|
if (isEmpty) {
|
|
163
169
|
this.#content.classList.add('empty-block')
|
|
164
170
|
} else {
|
|
@@ -685,7 +685,10 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
685
685
|
const showAlign = !isMedia || isImageBlock
|
|
686
686
|
|
|
687
687
|
const isEmpty = node
|
|
688
|
-
? node.
|
|
688
|
+
? node.type.name === 'paragraph' &&
|
|
689
|
+
node.textContent.length === 0 &&
|
|
690
|
+
node.content.size <= 2 &&
|
|
691
|
+
!isMedia
|
|
689
692
|
: false
|
|
690
693
|
|
|
691
694
|
const currentAlign = node?.attrs?.align || 'left'
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
.milkdown {
|
|
2
|
-
&:has(.milkdown-slash-menu[data-show='true'][data-mode='block'])
|
|
3
|
-
|
|
2
|
+
&:has(.milkdown-slash-menu[data-show='true'][data-mode='block'])
|
|
3
|
+
.milkdown-block-handle,
|
|
4
|
+
&:has(.milkdown-slash-menu[data-show='true'][data-mode='list'])
|
|
5
|
+
.milkdown-block-handle {
|
|
4
6
|
opacity: 1 !important;
|
|
5
7
|
pointer-events: auto !important;
|
|
6
8
|
}
|
|
@@ -107,7 +109,7 @@
|
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
position: absolute;
|
|
110
|
-
z-index:
|
|
112
|
+
z-index: 200;
|
|
111
113
|
display: block;
|
|
112
114
|
font-family: var(--crepe-font-default);
|
|
113
115
|
color: var(--crepe-color-on-surface);
|
|
@@ -334,6 +334,25 @@
|
|
|
334
334
|
.preview {
|
|
335
335
|
text-align: center;
|
|
336
336
|
overflow-x: auto;
|
|
337
|
+
--mermaid-font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
|
338
|
+
|
|
339
|
+
svg * {
|
|
340
|
+
font-family: 'trebuchet ms', verdana, arial, sans-serif !important;
|
|
341
|
+
line-height: normal !important;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
svg .relationshipLabel,
|
|
345
|
+
svg .relationshipLabel *,
|
|
346
|
+
svg .edgeLabel,
|
|
347
|
+
svg .edgeLabel *,
|
|
348
|
+
svg .edgeLabelText,
|
|
349
|
+
svg .edgeLabelText * {
|
|
350
|
+
font-size: 11px !important;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
svg foreignObject {
|
|
354
|
+
overflow: visible !important;
|
|
355
|
+
}
|
|
337
356
|
}
|
|
338
357
|
}
|
|
339
358
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.milkdown {
|
|
2
2
|
.milkdown-link-preview {
|
|
3
3
|
position: absolute;
|
|
4
|
-
z-index:
|
|
4
|
+
z-index: 200;
|
|
5
5
|
&[data-show='false'] {
|
|
6
6
|
display: none;
|
|
7
7
|
}
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
|
|
72
72
|
.milkdown-link-edit {
|
|
73
73
|
position: absolute;
|
|
74
|
-
z-index:
|
|
74
|
+
z-index: 200;
|
|
75
75
|
&[data-show='false'] {
|
|
76
76
|
display: none;
|
|
77
77
|
}
|