roosterjs 9.18.0 → 9.19.0

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.
@@ -71,14 +71,14 @@ var BridgePlugin = /** @class */ (function () {
71
71
  BridgePlugin.prototype.onPluginEvent = function (event) {
72
72
  var _this = this;
73
73
  var oldEvent = this.cacheGetOldEvent(event);
74
+ var exclusivelyHandleEventPlugin = this.cacheGetExclusivelyHandlePlugin(event);
75
+ if (exclusivelyHandleEventPlugin) {
76
+ this.handleEvent(exclusivelyHandleEventPlugin, oldEvent, event);
77
+ }
78
+ else {
79
+ this.legacyPlugins.forEach(function (plugin) { return _this.handleEvent(plugin, oldEvent, event); });
80
+ }
74
81
  if (oldEvent) {
75
- var exclusivelyHandleEventPlugin = this.cacheGetExclusivelyHandlePlugin(event);
76
- if (exclusivelyHandleEventPlugin) {
77
- this.handleEvent(exclusivelyHandleEventPlugin, oldEvent, event);
78
- }
79
- else {
80
- this.legacyPlugins.forEach(function (plugin) { return _this.handleEvent(plugin, oldEvent, event); });
81
- }
82
82
  Object.assign(event, (0, eventConverter_1.oldEventToNewEvent)(oldEvent, event));
83
83
  }
84
84
  };
@@ -106,15 +106,13 @@ var BridgePlugin = /** @class */ (function () {
106
106
  return (0, roosterjs_content_model_dom_1.cacheGetEventData)(event, ExclusivelyHandleEventPluginKey, function (event) {
107
107
  var _a, _b;
108
108
  var oldEvent = _this.cacheGetOldEvent(event);
109
- if (oldEvent) {
110
- for (var i = 0; i < _this.legacyPlugins.length; i++) {
111
- var plugin = _this.legacyPlugins[i];
112
- if ((_a = plugin.willHandleEventExclusively) === null || _a === void 0 ? void 0 : _a.call(plugin, oldEvent)) {
113
- return plugin;
114
- }
115
- if (isMixedPlugin(plugin) && ((_b = plugin.willHandleEventExclusivelyV9) === null || _b === void 0 ? void 0 : _b.call(plugin, event))) {
116
- return plugin;
117
- }
109
+ for (var i = 0; i < _this.legacyPlugins.length; i++) {
110
+ var plugin = _this.legacyPlugins[i];
111
+ if (oldEvent && ((_a = plugin.willHandleEventExclusively) === null || _a === void 0 ? void 0 : _a.call(plugin, oldEvent))) {
112
+ return plugin;
113
+ }
114
+ if (isMixedPlugin(plugin) && ((_b = plugin.willHandleEventExclusivelyV9) === null || _b === void 0 ? void 0 : _b.call(plugin, event))) {
115
+ return plugin;
118
116
  }
119
117
  }
120
118
  return null;
@@ -135,10 +133,12 @@ var BridgePlugin = /** @class */ (function () {
135
133
  };
136
134
  };
137
135
  BridgePlugin.prototype.handleEvent = function (plugin, oldEvent, newEvent) {
138
- var _a, _b;
139
- (_a = plugin.onPluginEvent) === null || _a === void 0 ? void 0 : _a.call(plugin, oldEvent);
136
+ var _a;
137
+ if (oldEvent && plugin.onPluginEvent) {
138
+ plugin.onPluginEvent(oldEvent);
139
+ }
140
140
  if (isMixedPlugin(plugin)) {
141
- (_b = plugin.onPluginEventV9) === null || _b === void 0 ? void 0 : _b.call(plugin, newEvent);
141
+ (_a = plugin.onPluginEventV9) === null || _a === void 0 ? void 0 : _a.call(plugin, newEvent);
142
142
  }
143
143
  };
144
144
  return BridgePlugin;