第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

CKEditor5富文本編輯器如何取值

CKEditor5富文本編輯器如何取值

回首憶惘然 2019-03-12 17:15:20
html中引入了CKEditor5的js代碼,然后通過下面代碼綁定到textarea元素上面。<textarea name="content" id="editor">    <p>Here goes the initial content of the editor.</p></textarea>ClassicEditor    .create( document.querySelector( '#editor' ) )    .then( editor => {        console.log( editor );    } )    .catch( error => {        console.error( error );    } );然后js的方式就不能獲取到textarea的文本節(jié)點,查看CKEditor的API問題,發(fā)現(xiàn)可以通過editor.getData()獲??;但是只能剛加載的時候獲取,如何做到,點擊某個按鈕就能拿到文本框內(nèi)容呢?
查看完整描述

2 回答

?
縹緲止盈

TA貢獻2041條經(jīng)驗 獲得超4個贊


ClassicEditor


    .create( document.querySelector( '#editor' ), {  

        //工具欄,可選擇添加或去除

        toolbar: ['headings', 'bold', 'italic', 'blockQuote', 'bulletedList', 'numberedList', 'link', 'cut','undo','redo'],

        //toolbar: ['headings', 'bold', 'italic', 'blockQuote', 'bulletedList', 'numberedList', 'link', 'ImageUpload', 'cut','undo','redo'],

        //editor加載中文簡體,默認是英文

        language: 'zh-cn' 

        //,ckfinder: {

        //    uploadUrl: '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json'

        //}

        //image: {

        //    // You need to configure the image toolbar, too, so it uses the new style buttons.

        //    toolbar: [ 'imageTextAlternative', '|', 'imageStyle:alignLeft', 'imageStyle:full', 'imageStyle:alignRight' ],


        //    styles: [

        //        // This option is equal to a situation where no style is applied.

        //        'full',


        //        // This represents an image aligned to the left.

        //        'alignLeft',


        //        // This represents an image aligned to the right.

        //        'alignRight' ,


        //        'side'

        //    ]

        //},

    } )

    .then( editor => {

        window.editor = editor;

} )

    .catch( err => {

        console.error( err.stack );

} );


 

var a = document.getElementById("editor"); //取得純文本


alert(a.innerHTML);

alert(a.textContent);


查看完整回答
反對 回復 2019-04-03
?
繁華開滿天機

TA貢獻1816條經(jīng)驗 獲得超4個贊

有木有人咧?。?!


查看完整回答
反對 回復 2019-04-03
  • 2 回答
  • 0 關(guān)注
  • 3470 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號