在 Ckeditor 中如何复制/获取选定文本的所有格式

发布于 2024-12-25 14:42:36 字数 213 浏览 3 评论 0原文

我在我的 Asp.net MVC 3 应用程序中使用 CKEditor ver.3.6。

我的要求是在 Google 文档中创建 Paint 格式选项。我需要在 ckeditor 中实现 Paint 格式选项。

在 Ckeditor 中,如何将所有格式(例如字体、字体效果、居中段落对齐)从选定的文本(源)复制/获取到新选定的文本(目标)。

请提出正确的解决方案。

I am using CKEditor ver.3.6 in my Asp.net MVC 3 Application.

My requirement is to create Paint format option in the Google doc.I need to implement Paint format option in a ckeditor.

In Ckeditor how to copy/get all formatting such as font, font effects, centered paragraph alignment from a selected text(source) to a newly selected text (destination).

Please suggest a proper solution.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最舍不得你 2025-01-01 14:42:36

使用此功能可将选定 html 的内容替换为一个字段中的文本。单击按钮时,调用此函数:

function Replace()
 {  
     var sel = editor.getSelection();   
     var ele=sel.getStartElement();
     if(ele.hasAttributes())
     {
        var insertele= editor.document.createElement('span');
        ele.copyAttributes(insertele,{type:1,value:1})
        insertele.setHtml($("#repTxt").val());
        editor.insertElement(insertele);        
     }  

 }

Use this function to replace the content of a selected html with the text in one field. On a button click, call this function:

function Replace()
 {  
     var sel = editor.getSelection();   
     var ele=sel.getStartElement();
     if(ele.hasAttributes())
     {
        var insertele= editor.document.createElement('span');
        ele.copyAttributes(insertele,{type:1,value:1})
        insertele.setHtml($("#repTxt").val());
        editor.insertElement(insertele);        
     }  

 }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文