欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基于語雀編輯器的在線文檔編輯與查看功能

 更新時間:2024年07月12日 12:14:21   作者:牛老師講GIS  
語雀是一個非常優(yōu)秀的文檔和知識庫工具,其編輯器更是非常好用,雖無開源版本,但有編譯好的可以使用,本文基于語雀編輯器實現(xiàn)在線文檔的編輯與文章的預覽,感興趣的朋友一起看看吧

概述

語雀是一個非常優(yōu)秀的文檔和知識庫工具,其編輯器更是非常好用,雖無開源版本,但有編譯好的可以使用。本文基于語雀編輯器實現(xiàn)在線文檔的編輯與文章的預覽。

實現(xiàn)效果

實現(xiàn)

參考語雀編輯器官方文檔,其實現(xiàn)需要引入以下文件:

<link rel="stylesheet" type="text/css"  rel="external nofollow" />
<link rel="stylesheet" type="text/css"  rel="external nofollow" />
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
<script src="https://gw.alipayobjects.com/render/p/yuyan_npm/@alipay_lakex-doc/1.1.0-beta.1/umd/doc.umd.js"></script>

1. 文檔編輯

const { createOpenEditor, toolbarItems } = window.Doc;
docEditor = createOpenEditor(this.$refs.editor, {
  toolbar: {
    agentConfig: {
      default: {
        items: [
          toolbarItems.cardSelect,
          '|',
          toolbarItems.undo,
          toolbarItems.redo,
          toolbarItems.formatPainter,
          toolbarItems.clearFormat,
          '|',
          toolbarItems.style,
          toolbarItems.fontsize,
          toolbarItems.bold,
          toolbarItems.italic,
          toolbarItems.strikethrough,
          toolbarItems.underline,
          toolbarItems.mixedTextStyle,
          '|',
          toolbarItems.color,
          toolbarItems.bgColor,
          '|',
          toolbarItems.alignment,
          toolbarItems.unorderedList,
          toolbarItems.orderedList,
          toolbarItems.indent,
          toolbarItems.lineHeight,
          '|',
          toolbarItems.taskList,
          toolbarItems.link,
          toolbarItems.quote,
          toolbarItems.hr,
        ]
      },
      // table選區(qū)工具欄
      table: {
        items: [
          toolbarItems.cardSelect,
          '|',
          toolbarItems.undo,
          toolbarItems.redo,
          toolbarItems.formatPainter,
          toolbarItems.clearFormat,
          '|',
          toolbarItems.style,
          toolbarItems.fontsize,
          toolbarItems.bold,
          toolbarItems.italic,
          toolbarItems.strikethrough,
          toolbarItems.underline,
          toolbarItems.mixedTextStyle,
          '|',
          toolbarItems.color,
          toolbarItems.bgColor,
          toolbarItems.tableCellBgColor,
          toolbarItems.tableBorderVisible,
          '|',
          toolbarItems.alignment,
          toolbarItems.tableVerticalAlign,
          toolbarItems.tableMergeCell,
          '|',
          toolbarItems.unorderedList,
          toolbarItems.orderedList,
          toolbarItems.indent,
          toolbarItems.lineHeight,
          '|',
          toolbarItems.taskList,
          toolbarItems.link,
          toolbarItems.quote,
          toolbarItems.hr,
        ],
      }
    }
  },
  image: {
    isCaptureImageURL:(url) => {
      // return false表示需要轉存,會調用createUploadPromise
      return false;
    },
    // 配置上傳接口,要返回一個promise對象
    createUploadPromise: (request) => {
      const {type, data} = request;
      if(type === 'url') {
        return Promise.resolve({
          url: url,
          filename: '上傳圖片'
        });
      } else if(type === 'file') {
        return new Promise(resolve => {
          let formData = new FormData();
          formData.set("file", data);
          //這里使用封裝的上傳文件的接口
          upload('file/upload/img', formData)
            .then(res => {
              if(res.code === 200) {
                const {fileName, url} = res.data
                resolve({
                  url: url,
                  filename: fileName
                });
              } else {
                ElMessage({
                  message: '圖片上傳失敗!',
                  type: 'warning',
                })
              }
            })
        })
      }
    },
  }
});
window.docEditor = docEditor
// 獲取文檔內容
docEditor.getDocument('text/lake')
// 設置文檔內容
docEditor.setDocument('text/lake', docContent);

2. 文章預覽

const { createOpenViewer } = window.Doc;
// 創(chuàng)建閱讀器
 const viewer = createOpenViewer(this.$refs.editor, {});
viewer.setDocument('text/lake', docContent);

到此這篇關于基于語雀編輯器的在線文檔編輯與查看的文章就介紹到這了,更多相關語雀編輯器內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

  • 淺析getway網(wǎng)關

    淺析getway網(wǎng)關

    這篇文章主要介紹了getway網(wǎng)關的相關知識,getway可以實現(xiàn)nginx的請求轉發(fā)和跨域(@CrossOrigin也可以實現(xiàn)跨域),本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-07-07
  • Wordpress 忘記密碼的處理方法

    Wordpress 忘記密碼的處理方法

    有時候不小心忘了wordpress的密碼了,大家可以按照下面的方法試試。
    2009-05-05
  • 詳解git merge 與 git rebase的區(qū)別

    詳解git merge 與 git rebase的區(qū)別

    這篇文章主要介紹了詳解git merge 與 git rebase的區(qū)別,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-07-07
  • 漂流瓶推送需求的邏輯實現(xiàn)代碼

    漂流瓶推送需求的邏輯實現(xiàn)代碼

    假想有一個瓶子池,當點擊附近標簽的時候要從池里面推送一個瓶子給用戶.推送按照一定的邏輯對池里的瓶子排序,排序規(guī)則主要由兩個數(shù)據(jù)決定:瓶子上次推送時間和與用戶之間的距離.
    2010-12-12
  • 各種編程語言中$符號的意義

    各種編程語言中$符號的意義

    這篇文章主要介紹了各種編程語言中$符號的意義,本文是給編程新看看的,$符號在多種編程語言中都在使用,需要的朋友可以參考下
    2014-09-09
  • 在VScode中創(chuàng)建你的代碼模板的方法

    在VScode中創(chuàng)建你的代碼模板的方法

    這篇文章主要介紹了在VScode中創(chuàng)建你的代碼模板的方法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-04-04
  • 在github上怎樣修改語言設置

    在github上怎樣修改語言設置

    這篇文章主要介紹了在github上怎樣修改語言設置問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-09-09
  • git與svn的區(qū)別及優(yōu)缺點說明

    git與svn的區(qū)別及優(yōu)缺點說明

    Git和SVN都是版本控制系統(tǒng),用于代碼管理,SVN是集中式的,需要聯(lián)網(wǎng)并且中央服務器存在單點故障的風險,Git是分布式的,每個終端都是一個完整的倉庫,不依賴中央服務器,提高了工作的靈活性和安全性,SVN易于管理權限,但必須聯(lián)網(wǎng)工作且更新提交可能面臨沖突
    2024-10-10
  • Websocket直播間聊天室教程  GoEasy快速實現(xiàn)聊天室

    Websocket直播間聊天室教程 GoEasy快速實現(xiàn)聊天室

    這篇文章主要介紹了Websocket直播間聊天室教程 GoEasy快速實現(xiàn)聊天室,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-05-05
  • 使用Git Hook技術定義和校驗代碼提交模板方式

    使用Git Hook技術定義和校驗代碼提交模板方式

    這篇文章主要介紹了使用Git Hook技術定義和校驗代碼提交模板方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-11-11

最新評論