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

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

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

概述

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

實(shí)現(xiàn)效果

實(shí)現(xiàn)

參考語(yǔ)雀編輯器官方文檔,其實(shí)現(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表示需要轉(zhuǎn)存,會(huì)調(diào)用createUploadPromise
      return false;
    },
    // 配置上傳接口,要返回一個(gè)promise對(duì)象
    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
// 獲取文檔內(nèi)容
docEditor.getDocument('text/lake')
// 設(shè)置文檔內(nèi)容
docEditor.setDocument('text/lake', docContent);

2. 文章預(yù)覽

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

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

相關(guān)文章

  • 淺析getway網(wǎng)關(guān)

    淺析getway網(wǎng)關(guān)

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

    Wordpress 忘記密碼的處理方法

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

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

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

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

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

    各種編程語(yǔ)言中$符號(hào)的意義

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

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

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

    在github上怎樣修改語(yǔ)言設(shè)置

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

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

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

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

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

    使用Git Hook技術(shù)定義和校驗(yàn)代碼提交模板方式

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

最新評(píng)論