@milkdown/vue 7.2.0 → 7.2.2

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 CHANGED
@@ -4,7 +4,7 @@ Vue integration for [milkdown](https://milkdown.dev/).
4
4
 
5
5
  # Official Documentation
6
6
 
7
- Documentation can be found on the [Milkdown website](https://milkdown.dev/vue).
7
+ Documentation can be found on the [Milkdown website](https://milkdown.dev/docs/api/vue).
8
8
 
9
9
  # License
10
10
 
package/lib/index.es.js CHANGED
@@ -5,7 +5,7 @@ const g = () => {
5
5
  if (!e.value)
6
6
  return;
7
7
  const t = r.value(e.value);
8
- !t || (o.value = !0, t.create().then((u) => {
8
+ t && (o.value = !0, t.create().then((u) => {
9
9
  n.value = u;
10
10
  }).finally(() => {
11
11
  o.value = !1;
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../src/useGetEditor.ts","../src/Editor.tsx","../src/useEditor.ts","../src/useInstance.ts"],"sourcesContent":["/* Copyright 2021, Milkdown by Mirone. */\nimport { inject, onMounted, onUnmounted } from 'vue'\n\nimport type { EditorInfoCtx } from './types'\nimport { editorInfoCtxKey } from '.'\n\nexport const useGetEditor = () => {\n const { dom, loading, editor: editorRef, editorFactory: getEditor } = inject(editorInfoCtxKey, {} as EditorInfoCtx)\n\n onMounted(() => {\n if (!dom.value)\n return\n\n const editor = getEditor.value!(dom.value)\n if (!editor)\n return\n\n loading.value = true\n editor\n .create()\n .then((editor) => {\n editorRef.value = editor\n })\n .finally(() => {\n loading.value = false\n })\n .catch(console.error)\n })\n onUnmounted(() => {\n editorRef.value?.destroy()\n })\n\n return dom\n}\n","/* Copyright 2021, Milkdown by Mirone. */\n/* eslint-disable vue/one-component-per-file */\nimport type { Editor } from '@milkdown/core'\nimport type { InjectionKey } from 'vue'\nimport {\n Fragment,\n defineComponent,\n h,\n provide,\n ref,\n} from 'vue'\n\nimport type { EditorInfoCtx, GetEditor } from './types'\nimport { useGetEditor } from './useGetEditor'\n\nexport const editorInfoCtxKey: InjectionKey<EditorInfoCtx> = Symbol('editorInfoCtxKey')\n\nexport const Milkdown = defineComponent({\n name: 'Milkdown',\n setup: () => {\n const domRef = useGetEditor()\n\n return () => <div data-milkdown-root ref={domRef} />\n },\n})\n\nexport const MilkdownProvider = defineComponent({\n name: 'MilkdownProvider',\n setup: (_, { slots }) => {\n const dom = ref<HTMLDivElement | null>(null)\n const editorFactory = ref<GetEditor | undefined>(undefined)\n const editor = ref<Editor | undefined>(undefined)\n const loading = ref(true)\n\n provide(editorInfoCtxKey, {\n loading,\n dom,\n editor,\n editorFactory,\n })\n\n return () => <>{slots.default?.()}</>\n },\n})\n","/* Copyright 2021, Milkdown by Mirone. */\n\nimport { inject } from 'vue'\nimport { editorInfoCtxKey } from './Editor'\n\nimport type { GetEditor, UseEditorReturn } from './types'\n\nexport const useEditor = (getEditor: GetEditor): UseEditorReturn => {\n const { editorFactory, loading, editor } = inject(editorInfoCtxKey)!\n\n editorFactory.value = getEditor\n\n return {\n loading,\n get: () => editor.value,\n }\n}\n","/* Copyright 2021, Milkdown by Mirone. */\nimport type { Editor } from '@milkdown/core'\nimport type { Ref } from 'vue'\nimport { inject } from 'vue'\nimport { editorInfoCtxKey } from './Editor'\n\nexport type Instance = [Ref<true>, () => undefined] | [Ref<false>, () => Editor]\n\nexport const useInstance = (): Instance => {\n const editorInfo = inject(editorInfoCtxKey)!\n\n return [editorInfo.loading, () => editorInfo.editor.value] as Instance\n}\n"],"names":["useGetEditor","dom","loading","editorRef","getEditor","inject","editorInfoCtxKey","onMounted","editor","onUnmounted","_a","Symbol","Milkdown","defineComponent","name","setup","domRef","_createVNode","MilkdownProvider","_","slots","ref","editorFactory","undefined","provide","_Fragment","default","useEditor","useInstance","editorInfo"],"mappings":";AAMO,MAAMA,IAAe,MAAM;AAC1B,QAAA,EAAE,KAAAC,GAAK,SAAAC,GAAS,QAAQC,GAAW,eAAeC,MAAcC,EAAOC,GAAkB,CAAmB,CAA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AkB,GAAe,SAAApB,GAAS,QAAAM,EAAO,IAAIH,EAAOC,CAAgB;AAElE,SAAAgB,EAAc,QAAQlB,GAEf;AAAA,IACL,SAAAF;AAAA,IACA,KAAK,MAAMM,EAAO;AAAA,EAAA;AAEtB,GCRaoB,IAAc,MAAgB;AACnC,QAAAC,IAAaxB,EAAOC,CAAgB;AAE1C,SAAO,CAACuB,EAAW,SAAS,MAAMA,EAAW,OAAO,KAAK;AAC3D;"}
1
+ {"version":3,"file":"index.es.js","sources":["../src/useGetEditor.ts","../src/Editor.tsx","../src/useEditor.ts","../src/useInstance.ts"],"sourcesContent":["/* Copyright 2021, Milkdown by Mirone. */\nimport { inject, onMounted, onUnmounted } from 'vue'\n\nimport type { EditorInfoCtx } from './types'\nimport { editorInfoCtxKey } from '.'\n\nexport const useGetEditor = () => {\n const { dom, loading, editor: editorRef, editorFactory: getEditor } = inject(editorInfoCtxKey, {} as EditorInfoCtx)\n\n onMounted(() => {\n if (!dom.value)\n return\n\n const editor = getEditor.value!(dom.value)\n if (!editor)\n return\n\n loading.value = true\n editor\n .create()\n .then((editor) => {\n editorRef.value = editor\n })\n .finally(() => {\n loading.value = false\n })\n .catch(console.error)\n })\n onUnmounted(() => {\n editorRef.value?.destroy()\n })\n\n return dom\n}\n","/* Copyright 2021, Milkdown by Mirone. */\n/* eslint-disable vue/one-component-per-file */\nimport type { Editor } from '@milkdown/core'\nimport type { InjectionKey } from 'vue'\nimport {\n Fragment,\n defineComponent,\n h,\n provide,\n ref,\n} from 'vue'\n\nimport type { EditorInfoCtx, GetEditor } from './types'\nimport { useGetEditor } from './useGetEditor'\n\nexport const editorInfoCtxKey: InjectionKey<EditorInfoCtx> = Symbol('editorInfoCtxKey')\n\nexport const Milkdown = defineComponent({\n name: 'Milkdown',\n setup: () => {\n const domRef = useGetEditor()\n\n return () => <div data-milkdown-root ref={domRef} />\n },\n})\n\nexport const MilkdownProvider = defineComponent({\n name: 'MilkdownProvider',\n setup: (_, { slots }) => {\n const dom = ref<HTMLDivElement | null>(null)\n const editorFactory = ref<GetEditor | undefined>(undefined)\n const editor = ref<Editor | undefined>(undefined)\n const loading = ref(true)\n\n provide(editorInfoCtxKey, {\n loading,\n dom,\n editor,\n editorFactory,\n })\n\n return () => <>{slots.default?.()}</>\n },\n})\n","/* Copyright 2021, Milkdown by Mirone. */\n\nimport { inject } from 'vue'\nimport { editorInfoCtxKey } from './Editor'\n\nimport type { GetEditor, UseEditorReturn } from './types'\n\nexport const useEditor = (getEditor: GetEditor): UseEditorReturn => {\n const { editorFactory, loading, editor } = inject(editorInfoCtxKey)!\n\n editorFactory.value = getEditor\n\n return {\n loading,\n get: () => editor.value,\n }\n}\n","/* Copyright 2021, Milkdown by Mirone. */\nimport type { Editor } from '@milkdown/core'\nimport type { Ref } from 'vue'\nimport { inject } from 'vue'\nimport { editorInfoCtxKey } from './Editor'\n\nexport type Instance = [Ref<true>, () => undefined] | [Ref<false>, () => Editor]\n\nexport const useInstance = (): Instance => {\n const editorInfo = inject(editorInfoCtxKey)!\n\n return [editorInfo.loading, () => editorInfo.editor.value] as Instance\n}\n"],"names":["useGetEditor","dom","loading","editorRef","getEditor","inject","editorInfoCtxKey","onMounted","editor","onUnmounted","_a","Symbol","Milkdown","defineComponent","name","setup","domRef","_createVNode","MilkdownProvider","_","slots","ref","editorFactory","undefined","provide","_Fragment","default","useEditor","useInstance","editorInfo"],"mappings":";AAMO,MAAMA,IAAe,MAAM;AAC1B,QAAA,EAAE,KAAAC,GAAK,SAAAC,GAAS,QAAQC,GAAW,eAAeC,MAAcC,EAAOC,GAAkB,CAAmB,CAAA;AAElH,SAAAC,EAAU,MAAM;AACd,QAAI,CAACN,EAAI;AACP;AAEF,UAAMO,IAASJ,EAAU,MAAOH,EAAI,KAAK;AACzC,IAAKO,MAGLN,EAAQ,QAAQ,IAChBM,EACG,OAAO,EACP,KAAK,CAACA,MAAW;AAChB,MAAAL,EAAU,QAAQK;AAAAA,IAAA,CACnB,EACA,QAAQ,MAAM;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SAAS,MAAMA,EAAW,OAAO,KAAK;AAC3D;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@milkdown/vue",
3
3
  "type": "module",
4
- "version": "7.2.0",
4
+ "version": "7.2.2",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -27,12 +27,12 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "tslib": "^2.5.0",
30
- "@milkdown/utils": "7.2.0"
30
+ "@milkdown/utils": "7.2.2"
31
31
  },
32
32
  "devDependencies": {
33
33
  "vue": "^3.2.47",
34
- "@milkdown/core": "7.2.0",
35
- "@milkdown/prose": "7.2.0"
34
+ "@milkdown/core": "7.2.2",
35
+ "@milkdown/prose": "7.2.2"
36
36
  },
37
37
  "nx": {
38
38
  "targets": {