微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何更改ck编辑器的背景颜色?

如何解决如何更改ck编辑器的背景颜色?

我有一个深色背景,所以我为 ClassicEditor 应用了颜色,这是屏幕截图。

enter image description here

它工作正常,直到我将编辑器焦点移出它再次变白,这是编辑器焦点移出后的屏幕截图。

enter image description here

这是我的代码

    ClassicEditor
      .create($("#desc")[0],{
          language: $("html").attr("lang"),alignment: {
              options: ['left','right']
          },autoparagraph : false
      })
      .then(editor => {
          myEditor = editor;
          myEditor.model.document.on('change',(event) => {
              $("#desc").val(myEditor.getData());
          });
           
            $(".ck-content").css("background-color","rgb(32,41,64)");
            $(".ck-content p").css("color","white");
            $(".ck-toolbar").css("background-color",64)");
            $(".ck-button__label,.ck-icon").css("color","white");
            myEditor.editing.view.document.on('change:isFocused',( evt,data,isFocused ) => {
              if (isFocused) // blur
                  {
                    $(".ck-content").css("background-color",64)");
                  }else{
                    $(".ck-content p").css("csstext","background-color: rgb(32,64) !important; margin: 0px !important; padding: 3px 6px;");
                  


                    //this one not working
                    $(".ck-editor__editable").css("csstext",64) !important; padding : 0px;");
                  }
              });
          console.log(myEditor);
      })
      .catch(error => {
          console.error(error);
      });

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。