🐛 Fix insert image fail use attachment selector.
Build Plugin JAR File / build (push) Successful in 1m11s Details
Build Plugin JAR File / github-release (push) Has been skipped Details

Fix #62
This commit is contained in:
zhengyi 2024-02-09 00:10:20 +08:00
parent 56143952c4
commit 14ca6bf173
4 changed files with 19 additions and 5 deletions

View File

@ -12,7 +12,8 @@
- 🐛 修复行内公式渲染的问题 #22 - 🐛 修复行内公式渲染的问题 #22
- 🐛 修复操作栏修改属性不生效的问题 #20 \[vditor] - 🐛 修复操作栏修改属性不生效的问题 #20 \[vditor]
- 🐛 修复在 PJAX 主题下渲染器无法正常处理的问题 #24 - 🐛 修复在 PJAX 主题下渲染器无法正常处理的问题 #24
- 🐛 修复render样式与其他样式冲突的问题 - 🐛 修复 render 样式与其他样式冲突的问题
- 🐛 修复`插入图片`在 Safari 中不可用的问题
### v1.5.1 ### v1.5.1

View File

@ -11,6 +11,9 @@
<VButton type="primary" size="sm" @click="getPluginConfig"> <VButton type="primary" size="sm" @click="getPluginConfig">
Get Plugin Config Get Plugin Config
</VButton> </VButton>
<VButton type="primary" size="sm" @click="getCursor">
Get Last Cursor
</VButton>
</div> </div>
<div v-if="false" id="vditor-debug-data"> <div v-if="false" id="vditor-debug-data">
<div>Vditor DEBUG</div> <div>Vditor DEBUG</div>
@ -30,6 +33,7 @@ const debugOpOpen = ref<boolean>(false);
const props = defineProps<{ const props = defineProps<{
vditor: Vditor | null; vditor: Vditor | null;
config: EditorConfig | undefined; config: EditorConfig | undefined;
cursor: Range | undefined;
}>(); }>();
const getHTML = () => { const getHTML = () => {
@ -47,6 +51,12 @@ const getPluginConfig = () => {
console.log("CONFIG: ", props.config); console.log("CONFIG: ", props.config);
} }
}; };
const getCursor = () => {
if (props.cursor) {
console.log("LAST CURSOR", props.cursor);
}
};
</script> </script>
<style scoped> <style scoped>

View File

@ -1,5 +1,5 @@
export function getCursor() { export function getCursor() {
return window.getSelection()?.getRangeAt(0); return window.getSelection()?.getRangeAt(0).cloneRange();
} }
export function setCursor(range: Range | undefined) { export function setCursor(range: Range | undefined) {

View File

@ -52,8 +52,6 @@ const emit = defineEmits<{
(event: "update", value: string): void; (event: "update", value: string): void;
}>(); }>();
const customRenderList = ["halo"];
const debounceOnUpdate = () => { const debounceOnUpdate = () => {
emit("update:raw", vditor.value.getValue()); emit("update:raw", vditor.value.getValue());
emit("update:content", renderHTML(vditor.value) || ""); emit("update:content", renderHTML(vditor.value) || "");
@ -200,7 +198,12 @@ const update = (val: string | null) => {
<template> <template>
<div id="plugin-vditor-mde"> <div id="plugin-vditor-mde">
<VLoading v-if="!vditorLoaded" style="height: 100%" /> <VLoading v-if="!vditorLoaded" style="height: 100%" />
<DebugPanel v-if="debugMode" :config="editorConfig" :vditor="vditor" /> <DebugPanel
v-if="debugMode"
:config="editorConfig"
:vditor="vditor"
:cursor="lastSelectionRange"
/>
<div id="vditor" ref="vditorRef"></div> <div id="vditor" ref="vditorRef"></div>
<TemplateModal <TemplateModal
:open="customInsertOpen" :open="customInsertOpen"