@ckeditor/ckeditor5-widget 0.0.0-nightly-next-20250225.0 → 0.0.0-nightly-next-20250226.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.

Potentially problematic release.


This version of @ckeditor/ckeditor5-widget might be problematic. Click here for more details.

package/dist/index.js CHANGED
@@ -2157,7 +2157,7 @@ function selectionWillShrink(selection, isForward) {
2157
2157
  * @param options.items Array of toolbar items.
2158
2158
  * @param options.getRelatedElement Callback which returns an element the toolbar should be attached to.
2159
2159
  * @param options.balloonClassName CSS class for the widget balloon.
2160
- */ register(toolbarId, { ariaLabel, items, getRelatedElement, balloonClassName = 'ck-toolbar-container' }) {
2160
+ */ register(toolbarId, { ariaLabel, items, getRelatedElement, balloonClassName = 'ck-toolbar-container', positions }) {
2161
2161
  // Trying to register a toolbar without any item.
2162
2162
  if (!items.length) {
2163
2163
  /**
@@ -2197,6 +2197,7 @@ function selectionWillShrink(selection, isForward) {
2197
2197
  getRelatedElement,
2198
2198
  balloonClassName,
2199
2199
  itemsConfig: items,
2200
+ positions,
2200
2201
  initialized: false
2201
2202
  };
2202
2203
  // Register the toolbar so it becomes available for Alt+F10 and Esc navigation.
@@ -2261,7 +2262,7 @@ function selectionWillShrink(selection, isForward) {
2261
2262
  * should be still visible after the {@link module:ui/editorui/editorui~EditorUI#event:update}.
2262
2263
  */ _showToolbar(toolbarDefinition, relatedElement) {
2263
2264
  if (this._isToolbarVisible(toolbarDefinition)) {
2264
- repositionContextualBalloon(this.editor, relatedElement);
2265
+ repositionContextualBalloon(this.editor, relatedElement, toolbarDefinition.positions);
2265
2266
  } else if (!this._isToolbarInBalloon(toolbarDefinition)) {
2266
2267
  if (!toolbarDefinition.initialized) {
2267
2268
  toolbarDefinition.initialized = true;
@@ -2269,7 +2270,7 @@ function selectionWillShrink(selection, isForward) {
2269
2270
  }
2270
2271
  this._balloon.add({
2271
2272
  view: toolbarDefinition.view,
2272
- position: getBalloonPositionData(this.editor, relatedElement),
2273
+ position: getBalloonPositionData(this.editor, relatedElement, toolbarDefinition.positions),
2273
2274
  balloonClassName: toolbarDefinition.balloonClassName
2274
2275
  });
2275
2276
  // Update toolbar position each time stack with toolbar view is switched to visible.
@@ -2280,7 +2281,7 @@ function selectionWillShrink(selection, isForward) {
2280
2281
  for (const definition of this._toolbarDefinitions.values()){
2281
2282
  if (this._isToolbarVisible(definition)) {
2282
2283
  const relatedElement = definition.getRelatedElement(this.editor.editing.view.document.selection);
2283
- repositionContextualBalloon(this.editor, relatedElement);
2284
+ repositionContextualBalloon(this.editor, relatedElement, toolbarDefinition.positions);
2284
2285
  }
2285
2286
  }
2286
2287
  });
@@ -2293,17 +2294,17 @@ function selectionWillShrink(selection, isForward) {
2293
2294
  return this._balloon.hasView(toolbar.view);
2294
2295
  }
2295
2296
  }
2296
- function repositionContextualBalloon(editor, relatedElement) {
2297
+ function repositionContextualBalloon(editor, relatedElement, positions) {
2297
2298
  const balloon = editor.plugins.get('ContextualBalloon');
2298
- const position = getBalloonPositionData(editor, relatedElement);
2299
+ const position = getBalloonPositionData(editor, relatedElement, positions);
2299
2300
  balloon.updatePosition(position);
2300
2301
  }
2301
- function getBalloonPositionData(editor, relatedElement) {
2302
+ function getBalloonPositionData(editor, relatedElement, positions) {
2302
2303
  const editingView = editor.editing.view;
2303
2304
  const defaultPositions = BalloonPanelView.defaultPositions;
2304
2305
  return {
2305
2306
  target: editingView.domConverter.mapViewToDom(relatedElement),
2306
- positions: [
2307
+ positions: positions || [
2307
2308
  defaultPositions.northArrowSouth,
2308
2309
  defaultPositions.northArrowSouthWest,
2309
2310
  defaultPositions.northArrowSouthEast,