Skip to content

Commit

Permalink
Merge branch 'develop' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
imzbf committed Jun 12, 2024
2 parents 4ba4d35 + b41d1ab commit 46f6c7b
Show file tree
Hide file tree
Showing 11 changed files with 415 additions and 585 deletions.
45 changes: 23 additions & 22 deletions dev/Preview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import {
DropdownToolbar,
ModalToolbar,
config,
editorExtensionsAttrs,
StrIcon
editorExtensionsAttrs
} from '~~/index';
import type { ExposeParam } from '~~/index';
import mdText from '../data.md';
Expand Down Expand Up @@ -136,7 +135,7 @@ export default defineComponent({
},
setup(props) {
const storagedText = localStorage.getItem(SAVE_KEY) || '';
const storagedWidth = localStorage.getItem(INPUT_BOX_WITDH) || '200px';
const storagedWidth = localStorage.getItem(INPUT_BOX_WITDH) || '50%';
const md = reactive({
text: storagedText || mdText,
text2: 'Hello world',
Expand Down Expand Up @@ -347,25 +346,27 @@ export default defineComponent({
// toolbarsExclude={['github']}
onChange={(value) => (md.text = value)}
// noImgZoomIn
customIcon={{
// bold: {
// component: 'A',
// props: {}
// },
copy: StrIcon('copy', {}) // '<i class="fa fa-car"></i>',
// preview: {
// component: '<i class="fa fa-car"></i>',
// props: {
// name: 'copy'
// }
// },
// github: {
// component: Icon,
// props: {
// name: 'italic'
// }
// }
}}
customIcon={
{
// bold: {
// component: 'A',
// props: {}
// },
// copy: StrIcon('copy', {}) // '<i class="fa fa-car"></i>',
// preview: {
// component: '<i class="fa fa-car"></i>',
// props: {
// name: 'copy'
// }
// },
// github: {
// component: Icon,
// props: {
// name: 'italic'
// }
// }
}
}
onUploadImg={async (files, callback) => {
const res = await Promise.all(
files.map((file) => {
Expand Down
6 changes: 6 additions & 0 deletions dev/VueTemplate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<MdEditorV3
v-if="visible"
v-model="text"
:custom-icon="customIcon"
@on-drop="onDrop"
@on-change="onChange"
@on-input="onInput"
Expand All @@ -15,11 +16,16 @@

<script lang="ts" setup>
import { ref, watch } from 'vue';
import { StrIcon } from '~~/index';
import data from './data.md';
const text = ref(data);
const visible = ref(true);
const customIcon = {
copy: StrIcon('copy', {}) // '<i class="fa fa-car"></i>',
};
const changeVisible = () => {
visible.value = !visible.value;
};
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "md-editor-v3",
"version": "4.16.1-0",
"version": "4.16.7",
"license": "MIT",
"keywords": [
"vue",
Expand Down Expand Up @@ -39,7 +39,7 @@
],
"scripts": {
"dev": "tsx ./scripts/dev",
"build": "vue-tsc && tsx ./scripts/build"
"build": "tsx ./scripts/build"
},
"dependencies": {
"@codemirror/lang-markdown": "^6.2.5",
Expand Down Expand Up @@ -81,12 +81,11 @@
"multiparty": "^4.2.3",
"prettier": "^3.2.5",
"screenfull": "^6.0.2",
"tsc-alias": "^1.8.10",
"tsx": "^4.7.2",
"typescript": "5.4.5",
"vite": "^5.2.10",
"vite-plugin-dts": "^3.8.3",
"vue": "^3.4.23",
"vue-tsc": "^2.0.14"
"vue": "^3.4.23"
},
"peerDependencies": {
"vue": "^3.2.47"
Expand Down
1 change: 1 addition & 0 deletions packages/MdEditor/layouts/Content/composition/useResize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const useResize = (
() => props.inputBoxWitdh,
(nVal) => {
if (nVal) {
state.resizedWidth = nVal;
inputWrapperStyle.width = nVal;
resizeOperateStyle.left = nVal;
}
Expand Down
6 changes: 4 additions & 2 deletions packages/MdEditor/layouts/Content/markdownIt/code/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ const codetabs = (md: markdownit, _opts: CodeTabsPluginOps) => {
const copyBtnHtml = _opts.customIconRef.value.copy || codeCodeText;
const isIcon = !!_opts.customIconRef.value.copy;

const collapseTips = `<span class="${prefix}-collapse-tips">${StrIcon('collapse-tips', _opts.customIconRef.value)}</span>`;

const [GROUP] = getGroupAndTab(tokens[idx]);
if (GROUP === null) {
const { open, tagContainer, tagHeader } = getTagType(tokens[idx]);
Expand All @@ -88,7 +90,7 @@ const codetabs = (md: markdownit, _opts: CodeTabsPluginOps) => {
<div class="${prefix}-code-action">
<span class="${prefix}-code-lang">${tokens[idx].info.trim()}</span>
<span class="${prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? ' data-is-icon=true' : ''}">${copyBtnHtml}</span>
<span class="${prefix}-collapse-tips">${StrIcon('collapse-tips', _opts.customIconRef.value)}</span>
${tagContainer === 'details' ? collapseTips : ''}
</div>
</${tagHeader}>${codeRendered}</${tagContainer}>`;
}
Expand Down Expand Up @@ -145,7 +147,7 @@ const codetabs = (md: markdownit, _opts: CodeTabsPluginOps) => {
<div class="${prefix}-code-action">
<span class="${prefix}-codetab-lang">${langs}</span>
<span class="${prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? ' data-is-icon=true' : ''}">${copyBtnHtml}</span>
<span class="${prefix}-collapse-tips">${StrIcon('collapse-tips', _opts.customIconRef.value)}</span>
${tagContainer === 'details' ? collapseTips : ''}
</div>
</${tagHeader}>${pres}</${tagContainer}>`;
};
Expand Down
Loading

0 comments on commit 46f6c7b

Please sign in to comment.