@jvs-milkdown/components 1.1.6 → 1.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jvs-milkdown/components",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "keywords": [
5
5
  "milkdown",
6
6
  "milkdown plugin"
@@ -50,15 +50,15 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@floating-ui/dom": "^1.5.1",
53
- "@jvs-milkdown/core": "^1.1.6",
54
- "@jvs-milkdown/ctx": "^1.1.6",
55
- "@jvs-milkdown/exception": "^1.1.6",
56
- "@jvs-milkdown/plugin-tooltip": "^1.1.6",
57
- "@jvs-milkdown/preset-commonmark": "^1.1.6",
58
- "@jvs-milkdown/preset-gfm": "^1.1.6",
59
- "@jvs-milkdown/prose": "^1.1.6",
60
- "@jvs-milkdown/transformer": "^1.1.6",
61
- "@jvs-milkdown/utils": "^1.1.6",
53
+ "@jvs-milkdown/core": "^1.1.8",
54
+ "@jvs-milkdown/ctx": "^1.1.8",
55
+ "@jvs-milkdown/exception": "^1.1.8",
56
+ "@jvs-milkdown/plugin-tooltip": "^1.1.8",
57
+ "@jvs-milkdown/preset-commonmark": "^1.1.8",
58
+ "@jvs-milkdown/preset-gfm": "^1.1.8",
59
+ "@jvs-milkdown/prose": "^1.1.8",
60
+ "@jvs-milkdown/transformer": "^1.1.8",
61
+ "@jvs-milkdown/utils": "^1.1.8",
62
62
  "@types/lodash-es": "^4.17.12",
63
63
  "clsx": "^2.0.0",
64
64
  "dompurify": "^3.2.5",
@@ -96,16 +96,14 @@ export const ImageInput = defineComponent<ImageInputProps>({
96
96
  const isValidUrl = (url: string) => {
97
97
  if (!url) return false
98
98
  const trimmedUrl = url.trim()
99
- return /^(https?:\/\/|\/|\.\.?\/|data:image\/|blob:|[a-zA-Z0-9-]+\.[a-zA-Z]+)/i.test(
100
- trimmedUrl
101
- )
99
+ return /^(https?:\/\/|\/|\.\.?\/|data:image\/|blob:|[a-zA-Z0-9-]+\.[a-zA-Z]+)/i.test(trimmedUrl)
102
100
  }
103
101
 
104
102
  const onKeydown = (e: KeyboardEvent) => {
105
103
  if (e.key === 'Enter') {
106
104
  const val = linkInputRef.value?.value?.trim() ?? ''
107
105
 
108
- // Stop bubbling so ProseMirror doesn't handle the Enter key
106
+ // Stop bubbling so ProseMirror doesn't handle the Enter key
109
107
  // regardless of whether the URL is valid or not.
110
108
  e.preventDefault()
111
109
  e.stopPropagation()
@@ -187,22 +185,15 @@ export const ImageInput = defineComponent<ImageInputProps>({
187
185
  src={currentLink.value}
188
186
  alt=""
189
187
  onError={(e) =>
190
- Promise.resolve(onImageLoadError?.(e)).catch(() => {})
188
+ Promise.resolve(onImageLoadError?.(e)).catch(() => { })
191
189
  }
192
190
  />
193
191
  </div>
194
192
  )}
195
193
  <div
196
- class={clsx(
197
- 'confirm',
198
- !isValidUrl(currentLink.value) && 'disabled'
199
- )}
194
+ class={clsx('confirm', !isValidUrl(currentLink.value) && 'disabled')}
200
195
  onClick={() => onConfirmLinkInput()}
201
- style={
202
- !isValidUrl(currentLink.value)
203
- ? { opacity: 0.5, cursor: 'not-allowed' }
204
- : undefined
205
- }
196
+ style={!isValidUrl(currentLink.value) ? { opacity: 0.5, cursor: 'not-allowed' } : undefined}
206
197
  >
207
198
  <Icon icon={confirmButton} />
208
199
  </div>
@@ -45,9 +45,7 @@ export const EditLink = defineComponent<EditLinkProps>({
45
45
  if (!url) return false
46
46
  const trimmedUrl = url.trim()
47
47
  // Accept standard http/https links, relative links, anchors, or mailto
48
- return /^(https?:\/\/|\/|\.\.?\/|mailto:|#|[a-zA-Z0-9-]+\.[a-zA-Z]+)/i.test(
49
- trimmedUrl
50
- )
48
+ return /^(https?:\/\/|\/|\.\.?\/|mailto:|#|[a-zA-Z0-9-]+\.[a-zA-Z]+)/i.test(trimmedUrl)
51
49
  }
52
50
 
53
51
  const onConfirmEdit = () => {
@@ -86,17 +84,10 @@ export const EditLink = defineComponent<EditLinkProps>({
86
84
  />
87
85
  {link.value ? (
88
86
  <Icon
89
- class={clsx(
90
- 'button confirm',
91
- !isValidUrl(link.value) && 'disabled'
92
- )}
87
+ class={clsx('button confirm', !isValidUrl(link.value) && 'disabled')}
93
88
  icon={config.value.confirmButton}
94
89
  onClick={onConfirmEdit}
95
- style={
96
- !isValidUrl(link.value)
97
- ? { opacity: 0.5, cursor: 'not-allowed' }
98
- : undefined
99
- }
90
+ style={!isValidUrl(link.value) ? { opacity: 0.5, cursor: 'not-allowed' } : undefined}
100
91
  />
101
92
  ) : null}
102
93
  </div>