@kaitify/core 0.0.1-beta.17 → 0.0.1-beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38113,6 +38113,26 @@ class Editor {
38113
38113
  }
38114
38114
  return this.$el.textContent ?? "";
38115
38115
  }
38116
+ /**
38117
+ * 获取编辑器的html内容,该方法会返回一个包含style标签和div标签的html内容。自行展示html内容时可保证样式与编辑器一致,但是对于附件等有交互事件的元素交互事件会失效
38118
+ */
38119
+ getHTML() {
38120
+ let styles2 = "";
38121
+ for (const sheet of document.styleSheets) {
38122
+ try {
38123
+ for (const rule of sheet.cssRules) {
38124
+ styles2 += `${rule.cssText}
38125
+ `;
38126
+ }
38127
+ } catch (e) {
38128
+ console.warn("无法访问样式表");
38129
+ }
38130
+ }
38131
+ if (!styles2 || !this.$el) {
38132
+ return "";
38133
+ }
38134
+ return `<style>${styles2}</style><div class="kaitify">${this.$el.innerHTML}</div>`;
38135
+ }
38116
38136
  /**
38117
38137
  * 配置编辑器,返回创建的编辑器
38118
38138
  */