hookehuyr

表格组件使用命令直接新增一行和文字居中测试

<!--
* @Date: 2024-07-12 13:28:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-08-07 13:19:06
* @LastEditTime: 2024-08-19 17:09:50
* @FilePath: /data-table/src/components/TEditor/index.vue
* @Description: 文件描述
-->
<template>
<div style="height: 100%; overflow: hidden;">
<!-- <div @click="addRow">新增一行</div>
<div @click="textCenter">文字居中</div> -->
<editor
api-key="no-api-key"
v-model="myValue"
......@@ -212,7 +214,8 @@ const tinymceOptions = {
// toolbar: 'table', // 工具栏显示
toolbar: '', // 工具栏显示
table_toolbar: 'tableinsertrowafter', // table_toolbar 配置
contextmenu: 'tableinsertrowafter', // 右键菜单
// table_toolbar: '', // table_toolbar 配置
contextmenu: 'tableinsertrowafter aligncenter', // 右键菜单
width: $('.table-field-page').width() + 'px',
paste_data_images: false, //允许粘贴图像
// min_height: 300,
......@@ -328,6 +331,13 @@ const onBlur = (e) => {
emits("blur", handleGetContent());
}
const addRow = () => {
tinymce.activeEditor.execCommand('mceTableInsertRowAfter')
}
const textCenter = () => {
tinymce.activeEditor.execCommand('JustifyCenter')
}
defineExpose({
handleSetContent,
handleGetContent,
......