Skip to content

Commit

Permalink
Merge pull request #216 from People-Sea/fix/#213
Browse files Browse the repository at this point in the history
fix(ma-editor): 修复同一时刻渲染多富文本无效
  • Loading branch information
kanyxmo authored Dec 2, 2024
2 parents d891914 + dcf0449 commit 80f1c08
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/ma-editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const appStore = useAppStore()
const props = defineProps({
modelValue: {type: String},
height: {type: Number, default: 400},
id: {type: String, default: () => 'tinymce' + new Date().getTime().toString()},
id: {type: String, default: () => tool.uuid()},
plugins: {
type: [String, Array],
default:
Expand Down Expand Up @@ -132,7 +132,7 @@ const getStoreMode = (mode) => {
return uploadConfig.storageMode[mode.toString()]
}

const editorKey = ref(new Date().getTime())
const editorKey = props.id

watch(
() => list.value,
Expand Down
12 changes: 12 additions & 0 deletions src/utils/tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,16 @@ tool.arrSum = (arr) => {
return sum
}

tool.uuid = () => {
const randomBytes = CryptoJS.lib.WordArray.random(16);
const randomHex = randomBytes.toString(CryptoJS.enc.Hex);
return [
randomHex.substr(0, 8),
randomHex.substr(8, 4),
randomHex.substr(12, 4),
randomHex.substr(16, 4),
randomHex.substr(20, 12)
].join('-');
}

export default tool

0 comments on commit 80f1c08

Please sign in to comment.