@jvs-milkdown/crepe 1.2.28 → 1.2.29

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/feature/code-mirror/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAIlD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,wCAAwC,CAAA;AAG/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAe9C,UAAU,gBAAiB,SAAQ,eAAe;IAChD,KAAK,EAAE,SAAS,CAAA;IAChB,iBAAiB,EAAE,CAAC,eAAe,EAAE,OAAO,KAAK,MAAM,CAAA;IACvD,iBAAiB,EAAE,CAAC,eAAe,EAAE,OAAO,KAAK,MAAM,CAAA;CACxD;AAED,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAE/D,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,uBAAuB,CA+H7D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/feature/code-mirror/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAIlD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,wCAAwC,CAAA;AAG/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAe9C,UAAU,gBAAiB,SAAQ,eAAe;IAChD,KAAK,EAAE,SAAS,CAAA;IAChB,iBAAiB,EAAE,CAAC,eAAe,EAAE,OAAO,KAAK,MAAM,CAAA;IACvD,iBAAiB,EAAE,CAAC,eAAe,EAAE,OAAO,KAAK,MAAM,CAAA;CACxD;AAED,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAE/D,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,uBAAuB,CAoI7D,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jvs-milkdown/crepe",
3
- "version": "1.2.28",
3
+ "version": "1.2.29",
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.28",
111
- "@jvs-milkdown/prose": "^1.2.28",
112
- "@jvs-milkdown/utils": "^1.2.28",
110
+ "@jvs-milkdown/kit": "^1.2.29",
111
+ "@jvs-milkdown/prose": "^1.2.29",
112
+ "@jvs-milkdown/utils": "^1.2.29",
113
113
  "@types/lodash-es": "^4.17.12",
114
114
  "clsx": "^2.0.0",
115
115
  "codemirror": "^6.0.1",
@@ -66,24 +66,29 @@ export const codeMirror: DefineFeature<CodeMirrorFeatureConfig> = (
66
66
  noResultText:
67
67
  config.noResultText || i18n(ctx, 'codeMirror.noResultText'),
68
68
  renderLanguage: config.renderLanguage || defaultConfig.renderLanguage,
69
- renderPreview: config.renderPreview || ((language, content, applyPreview) => {
70
- if (language.toLowerCase() === 'mermaid' && content.trim().length > 0) {
71
- import('mermaid')
72
- .then(({ default: mermaid }) => {
73
- mermaid.initialize({
74
- startOnLoad: false,
75
- theme: 'default',
76
- themeVariables: {
77
- fontFamily: '"trebuchet ms", verdana, arial, sans-serif',
78
- },
79
- })
69
+ renderPreview:
70
+ config.renderPreview ||
71
+ ((language, content, applyPreview) => {
72
+ if (
73
+ language.toLowerCase() === 'mermaid' &&
74
+ content.trim().length > 0
75
+ ) {
76
+ import('mermaid')
77
+ .then(({ default: mermaid }) => {
78
+ mermaid.initialize({
79
+ startOnLoad: false,
80
+ theme: 'default',
81
+ themeVariables: {
82
+ fontFamily: '"trebuchet ms", verdana, arial, sans-serif',
83
+ },
84
+ })
80
85
 
81
- if (typeof document !== 'undefined') {
82
- const styleId = 'mermaid-global-measurement-styles'
83
- if (!document.getElementById(styleId)) {
84
- const styleEl = document.createElement('style')
85
- styleEl.id = styleId
86
- styleEl.textContent = `
86
+ if (typeof document !== 'undefined') {
87
+ const styleId = 'mermaid-global-measurement-styles'
88
+ if (!document.getElementById(styleId)) {
89
+ const styleEl = document.createElement('style')
90
+ styleEl.id = styleId
91
+ styleEl.textContent = `
87
92
  body,
88
93
  .mermaid,
89
94
  .relationshipLabel,
@@ -107,37 +112,37 @@ export const codeMirror: DefineFeature<CodeMirrorFeatureConfig> = (
107
112
  overflow: visible !important;
108
113
  }
109
114
  `
110
- document.head.appendChild(styleEl)
115
+ document.head.appendChild(styleEl)
116
+ }
111
117
  }
112
- }
113
118
 
114
- const id = `mermaid-${Math.random().toString(36).substring(2, 9)}`
115
- mermaid
116
- .render(id, content)
117
- .then(({ svg }) => {
118
- applyPreview(svg)
119
- })
120
- .catch((e) => {
121
- const errorEl = document.getElementById(`d${id}`)
122
- if (errorEl) {
123
- errorEl.remove()
124
- }
125
- applyPreview(
126
- `<div class="mermaid-error" style="color: red; padding: 10px; font-family: monospace;">${
127
- e instanceof Error ? e.message : String(e)
128
- }</div>`
129
- )
130
- })
131
- })
132
- .catch((err) => {
133
- applyPreview(
134
- `<div class="mermaid-error" style="color: red; padding: 10px; font-family: monospace;">Failed to load mermaid: ${err.message}</div>`
135
- )
136
- })
137
- return
138
- }
139
- return defaultConfig.renderPreview(language, content, applyPreview)
140
- }),
119
+ const id = `mermaid-${Math.random().toString(36).substring(2, 9)}`
120
+ mermaid
121
+ .render(id, content)
122
+ .then(({ svg }) => {
123
+ applyPreview(svg)
124
+ })
125
+ .catch((e) => {
126
+ const errorEl = document.getElementById(`d${id}`)
127
+ if (errorEl) {
128
+ errorEl.remove()
129
+ }
130
+ applyPreview(
131
+ `<div class="mermaid-error" style="color: red; padding: 10px; font-family: monospace;">${
132
+ e instanceof Error ? e.message : String(e)
133
+ }</div>`
134
+ )
135
+ })
136
+ })
137
+ .catch((err) => {
138
+ applyPreview(
139
+ `<div class="mermaid-error" style="color: red; padding: 10px; font-family: monospace;">Failed to load mermaid: ${err.message}</div>`
140
+ )
141
+ })
142
+ return
143
+ }
144
+ return defaultConfig.renderPreview(language, content, applyPreview)
145
+ }),
141
146
  previewToggleButton: (previewOnlyMode) => {
142
147
  const icon =
143
148
  config.previewToggleIcon?.(previewOnlyMode) ||
@@ -36,7 +36,7 @@
36
36
 
37
37
  font-family: var(--crepe-font-default);
38
38
  color: var(--crepe-color-on-background);
39
- background: var(--crepe-color-background);
39
+ background: var(--crepe-color-surface);
40
40
 
41
41
  .milkdown-icon {
42
42
  display: inline-flex;