@kaitify/core 0.0.1-beta.28 → 0.0.1-beta.29

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.
@@ -36956,7 +36956,7 @@ class Editor {
36956
36956
  * 如果编辑器内有滚动条,滚动编辑器到光标可视范围
36957
36957
  */
36958
36958
  scrollViewToSelection() {
36959
- if (this.selection.focused()) {
36959
+ if (this.selection.focused() && this.isEditable()) {
36960
36960
  const focusDom = this.findDom(this.selection.end.node);
36961
36961
  const scrollFunction = async (scrollEl) => {
36962
36962
  const scrollHeight = element.getScrollHeight(scrollEl);
@@ -38108,6 +38108,9 @@ class Editor {
38108
38108
  * 根据selection更新编辑器真实光标
38109
38109
  */
38110
38110
  async updateRealSelection() {
38111
+ if (!this.isEditable()) {
38112
+ return;
38113
+ }
38111
38114
  const realSelection = window.getSelection();
38112
38115
  if (!realSelection) {
38113
38116
  return;
@@ -38144,9 +38147,11 @@ class Editor {
38144
38147
  }
38145
38148
  }
38146
38149
  /**
38147
- * 重新渲染编辑器视图,不会触发onChange
38150
+ * 重新渲染编辑器视图
38151
+ * 1. 不会触发onChange事件;
38152
+ * 2. 不会渲染真实光标
38148
38153
  */
38149
- async review(value) {
38154
+ async review(value, unPushHistory = false) {
38150
38155
  if (typeof this.beforeUpdateView == "function") this.beforeUpdateView.apply(this);
38151
38156
  this.stackNodes = this.htmlParseNode(value || "");
38152
38157
  this.formatRules.forEach((rule) => {
@@ -38158,7 +38163,9 @@ class Editor {
38158
38163
  const useDefault = typeof this.onUpdateView == "function" ? await this.onUpdateView.apply(this, [true]) : true;
38159
38164
  if (useDefault) defaultUpdateView.apply(this, [true]);
38160
38165
  this.setDomObserve();
38161
- this.history.setState(this.stackNodes, this.selection);
38166
+ if (!unPushHistory) {
38167
+ this.history.setState(this.stackNodes, this.selection);
38168
+ }
38162
38169
  this.oldStackNodes = this.stackNodes.map((item) => item.fullClone());
38163
38170
  if (typeof this.afterUpdateView == "function") this.afterUpdateView.apply(this);
38164
38171
  }