CKEditor 5:如何向上/向下转换非元素文本字符串?
假设有以下输入:CKEditor 5:如何向上/向下转换非元素文本字符串?,ckeditor,ckeditor5,ckeditor5-plugin,Ckeditor,Ckeditor5,Ckeditor5 Plugin,假设有以下输入: <p>This is a string that contains a <span class="token">[some_token]</span>.</p> 然后向下转换到一个小部件: conversion.for( 'editingDowncast' ).elementToElement( { model: 'token', view: ( modelItem, { wr
<p>This is a string that contains a <span class="token">[some_token]</span>.</p>
然后向下转换到一个小部件:
conversion.for( 'editingDowncast' ).elementToElement( {
model: 'token',
view: ( modelItem, { writer: viewWriter } ) => {
const widgetElement = createTokenViewElement( modelItem, viewWriter );
viewWriter.addClass('token', widgetElement);
return toWidget( widgetElement, viewWriter );
}
} );
但是,如果你不想在元素中包装[some_token]
鉴于这一投入:
<p>This is a string that contains a [some_token].</p>
这是一个包含[some_token]的字符串
如果不将[某些\u标记]
包装在一个span中,那么一个类似的向上和向下转换将如何进行
<p>This is a string that contains a [some_token].</p>