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