@milkdown/vue 7.3.5 → 7.4.0

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":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAO,MAAM,KAAK,CAAA;AAS5C,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,SAAS,CAAA;AAQvD,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,aAAa,CAA8B,CAAA;AAEvF,eAAO,MAAM,QAAQ,mTAOnB,CAAA;AAEF,eAAO,MAAM,gBAAgB,mTAiB3B,CAAA"}
1
+ {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAO,MAAM,KAAK,CAAA;AAS5C,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,SAAS,CAAA;AAQvD,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,aAAa,CAA8B,CAAA;AAEvF,eAAO,MAAM,QAAQ,mTAOnB,CAAA;AAEF,eAAO,MAAM,gBAAgB,mTAiB3B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
@@ -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 function 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. */\nimport type { Editor } from '@milkdown/core'\nimport type { InjectionKey, Ref } 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\n// eslint-disable-next-line no-unused-expressions\nh\n// eslint-disable-next-line no-unused-expressions\nFragment\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) as Ref<Editor | 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 function 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 function 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,SAASA,IAAe;AACvB,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;AACb,MAAAN,EAAQ,QAAQ;AAAA,IACjB,CAAA,EACA,MAAM,QAAQ,KAAK;AAAA,EAAA,CACvB,GACDO,EAAY,MAAM;;AAChB,KAAAC,IAAAP,EAAU,UAAV,QAAAO,EAAiB;AAAA,EAAQ,CAC1B,GAEMT;AACT;MCdaK,IAAgDK,OAAO,kBAAkB,GAEzEC,IAAWC,gBAAAA,EAAgB;AAAA,EACtCC,MAAM;AAAA,EACNC,OAAOA,MAAM;AACX,UAAMC,IAAShB;AAEf,WAAO,MAAAiB,EAAA,OAAA;AAAA,MAAA,sBAAA;AAAA,MAAA,KAAmCD;AAAAA,IAAU,GAAA,IAAA;AAAA,EACtD;AACF,CAAC,GAEYE,IAAmBL,gBAAAA,EAAgB;AAAA,EAC9CC,MAAM;AAAA,EACNC,OAAOA,CAACI,GAAG;AAAA,IAAEC,OAAAA;AAAAA,EAAM,MAAM;AACvB,UAAMnB,IAAMoB,EAA2B,IAAI,GACrCC,IAAgBD,EAA2BE,MAAS,GACpDf,IAASa,EAAwBE,MAAS,GAC1CrB,IAAUmB,EAAI,EAAI;AAExBG,WAAAA,EAAQlB,GAAkB;AAAA,MACxBJ,SAAAA;AAAAA,MACAD,KAAAA;AAAAA,MACAO,QAAAA;AAAAA,MACAc,eAAAA;AAAAA,IACF,CAAC,GAEM,MAAA;;AAAAL,aAAAA,EAAAQ,GAAA,MAAA,EAASL,IAAAA,EAAMM,YAANN,gBAAAA,EAAAA,KAAAA,EAAiB,CAAI;AAAA;AAAA,EACvC;AACF,CAAC;ACxCM,SAASO,EAAUvB,GAAuC;AAC/D,QAAM,EAAE,eAAAkB,GAAe,SAAApB,GAAS,QAAAM,EAAO,IAAIH,EAAOC,CAAgB;AAElE,SAAAgB,EAAc,QAAQlB,GAEf;AAAA,IACL,SAAAF;AAAA,IACA,KAAK,MAAMM,EAAO;AAAA,EAAA;AAEtB;ACRO,SAASoB,IAAwB;AAChC,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":["import { inject, onMounted, onUnmounted } from 'vue'\n\nimport type { EditorInfoCtx } from './types'\nimport { editorInfoCtxKey } from '.'\n\nexport function 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","import type { Editor } from '@milkdown/core'\nimport type { InjectionKey, Ref } 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\n// eslint-disable-next-line no-unused-expressions\nh\n// eslint-disable-next-line no-unused-expressions\nFragment\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) as Ref<Editor | 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","import { inject } from 'vue'\nimport { editorInfoCtxKey } from './Editor'\n\nimport type { GetEditor, UseEditorReturn } from './types'\n\nexport function 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","import 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 function 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":";AAKO,SAASA,IAAe;AACvB,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;AACb,MAAAN,EAAQ,QAAQ;AAAA,IACjB,CAAA,EACA,MAAM,QAAQ,KAAK;AAAA,EAAA,CACvB,GACDO,EAAY,MAAM;;AAChB,KAAAC,IAAAP,EAAU,UAAV,QAAAO,EAAiB;AAAA,EAAQ,CAC1B,GAEMT;AACT;MCdaK,IAAgDK,OAAO,kBAAkB,GAEzEC,IAAWC,gBAAAA,EAAgB;AAAA,EACtCC,MAAM;AAAA,EACNC,OAAOA,MAAM;AACX,UAAMC,IAAShB;AAEf,WAAO,MAAAiB,EAAA,OAAA;AAAA,MAAA,sBAAA;AAAA,MAAA,KAAmCD;AAAAA,IAAU,GAAA,IAAA;AAAA,EACtD;AACF,CAAC,GAEYE,IAAmBL,gBAAAA,EAAgB;AAAA,EAC9CC,MAAM;AAAA,EACNC,OAAOA,CAACI,GAAG;AAAA,IAAEC,OAAAA;AAAAA,EAAM,MAAM;AACvB,UAAMnB,IAAMoB,EAA2B,IAAI,GACrCC,IAAgBD,EAA2BE,MAAS,GACpDf,IAASa,EAAwBE,MAAS,GAC1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IACrB,GAAG,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;CAC9B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B,MAAM,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,cAAc,KAAK,MAAM,CAAA;AAE7D,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC/B,aAAa,EAAE,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,CAAA;IACzC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,GAAG,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;CAC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../src/useEditor.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzD,wBAAgB,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,eAAe,CAS/D"}
1
+ {"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../src/useEditor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzD,wBAAgB,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,eAAe,CAS/D"}
@@ -1 +1 @@
1
- {"version":3,"file":"useGetEditor.d.ts","sourceRoot":"","sources":["../src/useGetEditor.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,6CA2B3B"}
1
+ {"version":3,"file":"useGetEditor.d.ts","sourceRoot":"","sources":["../src/useGetEditor.ts"],"names":[],"mappings":"AAKA,wBAAgB,YAAY,6CA2B3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"useInstance.d.ts","sourceRoot":"","sources":["../src/useInstance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAI9B,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC,CAAA;AAEhF,wBAAgB,WAAW,IAAI,QAAQ,CAItC"}
1
+ {"version":3,"file":"useInstance.d.ts","sourceRoot":"","sources":["../src/useInstance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAI9B,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC,CAAA;AAEhF,wBAAgB,WAAW,IAAI,QAAQ,CAItC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@milkdown/vue",
3
3
  "type": "module",
4
- "version": "7.3.5",
4
+ "version": "7.4.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -32,12 +32,12 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "tslib": "^2.5.0",
35
- "@milkdown/utils": "7.3.5"
35
+ "@milkdown/utils": "7.4.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "vue": "^3.3.4",
39
- "@milkdown/core": "7.3.5",
40
- "@milkdown/prose": "7.3.5"
39
+ "@milkdown/core": "7.4.0",
40
+ "@milkdown/prose": "7.4.0"
41
41
  },
42
42
  "nx": {
43
43
  "targets": {
package/src/Editor.tsx CHANGED
@@ -1,4 +1,3 @@
1
- /* Copyright 2021, Milkdown by Mirone. */
2
1
  import type { Editor } from '@milkdown/core'
3
2
  import type { InjectionKey, Ref } from 'vue'
4
3
  import {
package/src/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- /* Copyright 2021, Milkdown by Mirone. */
2
1
  export * from './Editor'
3
2
  export * from './types'
4
3
  export * from './useEditor'
package/src/types.ts CHANGED
@@ -1,4 +1,3 @@
1
- /* Copyright 2021, Milkdown by Mirone. */
2
1
  import type { Editor } from '@milkdown/core'
3
2
  import type { Ref } from 'vue'
4
3
 
package/src/useEditor.ts CHANGED
@@ -1,5 +1,3 @@
1
- /* Copyright 2021, Milkdown by Mirone. */
2
-
3
1
  import { inject } from 'vue'
4
2
  import { editorInfoCtxKey } from './Editor'
5
3
 
@@ -1,4 +1,3 @@
1
- /* Copyright 2021, Milkdown by Mirone. */
2
1
  import { inject, onMounted, onUnmounted } from 'vue'
3
2
 
4
3
  import type { EditorInfoCtx } from './types'
@@ -1,4 +1,3 @@
1
- /* Copyright 2021, Milkdown by Mirone. */
2
1
  import type { Editor } from '@milkdown/core'
3
2
  import type { Ref } from 'vue'
4
3
  import { inject } from 'vue'