Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderTongxin committed Mar 26, 2024
2 parents a96a36d + 0f8bb19 commit 7bdd798
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function useEditorMd(props: EditorMdProps, ctx: SetupContext) {
hintConfig,
disableChangeEvent,
modelValue,
beforeShowHint,
} = toRefs(props);

const toolbars = reactive(cloneDeep(DEFAULT_TOOLBARS));
Expand Down Expand Up @@ -202,6 +203,13 @@ export function useEditorMd(props: EditorMdProps, ctx: SetupContext) {
const cursor = editorIns.getCursor();
let i = prefixes.value.length;
const value = editorIns.getLine(cursor.line).replace(/\t/g, ' ');
let result = false;
if (beforeShowHint?.value) {
result = beforeShowHint.value(value);
}
if (result) {
return;
}
const selection = editorIns.getSelection();
const isImgRegx = /^\!\[\S+/;
if (selection) {
Expand Down
3 changes: 3 additions & 0 deletions packages/devui-vue/devui/editor-md/src/editor-md-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ export const editorMdProps = {
customHintReplaceFn: {
type: Function as PropType<(prefix: string, row: any) => string>,
},
beforeShowHint: {
type: Function as PropType<(value: string) => boolean>,
},
};

export type EditorMdProps = ExtractPropTypes<typeof editorMdProps>;
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-devui",
"version": "1.6.4-markdown.0",
"version": "1.6.4-markdown.1",
"license": "MIT",
"description": "DevUI components based on Vite and Vue3",
"keywords": [
Expand Down

0 comments on commit 7bdd798

Please sign in to comment.