1.0.3 • Published 6 months ago

oh-gov-docblack-beta v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

说明

oh-gov-docblack,是一个红头文件的编辑器,便捷的工具会让您信手拈来,如鱼得水

安装

使用 npm 安装
npm install oh-gov-docblack-beta
使用 yarn 安装
yarn add oh-gov-docblack-beta
使用 pnpm 安装
pnpm install oh-gov-docblack-beta

配置

main.js

import OhGovDocblack from 'oh-gov-docblack-beta';
// 引入样式
import "oh-gov-docblack/lib/oh-gov-docblack.css";

Vue.use(OhGovDocblack);

快速上手

在main.js引入后,在需要的页面直接引用即可。

<block-editor-module 
      ref="editorRef"
     :autoHeight="true"
     :docId="85">
</block-editor-module>

API

props

参数说明类型默认值可选值
docId文档id(编辑时回显文档,未传新增,传了编辑)Number--
height设置可编辑区域初始化高度(不传代表高度自适应页面高度)Number/String--
zIndexblock-editor-module层级Number1000-
tokentoken,用来请求公文模板、保存等接口String--
userInfo用户信息Object-详见
setting基于tinymce的配置项Object详见详见
mode编辑器展示效果Stringnomal(普通模式,展示所有功能界面)simple(极简模式,不显示头部和工具栏)
content编辑器出事内容String--
appkey----

methods

方法说明参数
tomyDocList点击我的公文处理方法-
save自定义保存方法公文内容

ref

下述的editorRef表示this.$refs.editorRef

参数说明示例
settingTitle设置/修改文件名称editorRef.settingTitle('测试文件名')
settingEditorContent设置/修改公文标签editorRef.settingEditorContent(['标签1','标签2'])
save_docment保存editorRef.save_docment()
correction_docment公文纠错editorRef.correction_docment()
uploadBtn打开导出弹框editorRef.uploadBtn()
exportDoc导出对应文件(参数可选项:word、pdf、image、html、txt、markdown)editorRef.uploadBtn('pdf')
tomyDocList我的公文(使用前应先传入点击我的公文处理方法tomyDocListeditorRef.tomyDocList()
openShareDialog打开分享弹框editorRef.openShareDialog()
showHistory打开公文历史弹框editorRef.showHistory()
wordGenHistList打开文件生成记录弹框editorRef.wordGenHistList()
devhelp打开开发对接说明弹框editorRef.devhelp()
showDocTemplate打开选择模板弹框editorRef.showDocTemplate()
handleCommandNew打开插入弹框(参数详情editorRef.handleCommandNew('gov_fwjg')
tinyMceCommand撤销/重做(可选参数:undo:撤销、redo:重做)editorRef.tinyMceCommand('undo')

userInfo可选项

参数说明类型
userName用户名String
userId用户idNumber

setting默认值

{
    placeholder: '开始拟写您的公文吧~',
    menubar: false,
    toolbar: false,
    statusbar: false,
    quickbars_selection_toolbar: " alignleft aligncenter alignright alignjustify  | bold italic underline strikethrough ",
    plugins: "govdoc_title1 link image media table lists fullscreen quickbars imagetools",
    quickbars_insert_toolbar: " quickimage table  | undo redo ",
    language: 'zh_CN',
    inline: true,
    images_upload_handler: (blobInfo, success, failure) => {
        const img = 'data:image/jpeg;base64,' + blobInfo.base64()
        success(img)
    },
    mobile: {
        toolbar: "undo redo | fullscreen | formatselect alignleft aligncenter alignright alignjustify | link unlink | numlist bullist | image media table | fontselect fontsizeselect forecolor backcolor | bold italic underline strikethrough | indent outdent | superscript subscript | removeformat |",
        toolbar_location: "bottom",
    },
    font_formats: "微软雅黑=Microsoft YaHei,Helvetica Neue;PingFang SC;sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun;serifsans-serif;Terminal=terminal;monaco;Times New Roman=times new roman;times", //字体
    extended_valid_elements: '*[id|class|title|style|data*|oh_*|oh_gb_type|path|src],svg[*],path[*],div[*],span[*],p[*],table[*],ul[*],li[*],a[*],td[*],tr[*],strong[*],u[*],oh:b[*],oh:s[*]',
    custom_elements: "~oh:b[*],~ohp[*]",
    short_ended_elements: 'area base basefont br col frame hr img input isindex link meta param embed source wbr track oh:b oh:s',

    forced_root_block: true,
    forced_root_block_attrs: {
        'class': 'oh_gov_block gov_zw',
        'oh_gb_type': "gov_zw",
        'id': `gov_${uuidv4()}`
    },
    auto_focus: true,
    table_default_attributes: {
        class: 'oh_gov_block gov_table',
        'oh_gb_type': "gov_table"
    },
    init_instance_callback: function (editor) {
        this.DFREditor = editor
        console.log('DFEditor: ' + editor.id + ' is now initialized.');
    },
    autoresize_min_height: 400,
    autoresize_max_height: 800
}

handleCommandNew参数选项

参数说明
gov_fwjg公文红头/发文机关
gov_fwzh发文字号
gov_fj附件
gov_zw正文
gov_gwbt公文标题
gov_yjbt一级标题
gov_ejbt二级标题
gov_fwjg_x1红头线
gov_fwjg_x2红头线2
gov_lk公文落款
gov_bj公文版记
gov_recive_dept接收单位
gov_next_page换页符
1.0.3

6 months ago

1.0.2

7 months ago

1.0.1

7 months ago