@ckeditor/ckeditor5-widget
Advanced tools
Comparing version 19.0.0 to 19.1.0
Changelog | ||
========= | ||
All changes in the package are documented in the main repository. See: https://github.com/ckeditor/ckeditor5/blob/master/CHANGELOG.md. | ||
Changes for the past releases are available below. | ||
## [19.0.0](https://github.com/ckeditor/ckeditor5-widget/compare/v18.0.0...v19.0.0) (2020-04-29) | ||
@@ -5,0 +9,0 @@ |
{ | ||
"Widget toolbar": "The label used by assistive technologies describing a toolbar attached to a widget." | ||
"Widget toolbar": "The label used by assistive technologies describing a toolbar attached to a widget.", | ||
"Insert paragraph before block": "The title displayed when a mouse is over a button that inserts a paragraph before a block.", | ||
"Insert paragraph after block": "The title displayed when a mouse is over a button that inserts a paragraph after a block." | ||
} |
{ | ||
"name": "@ckeditor/ckeditor5-widget", | ||
"version": "19.0.0", | ||
"version": "19.1.0", | ||
"description": "Widget API for CKEditor 5.", | ||
@@ -12,27 +12,23 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "^19.0.0", | ||
"@ckeditor/ckeditor5-engine": "^19.0.0", | ||
"@ckeditor/ckeditor5-ui": "^19.0.0", | ||
"@ckeditor/ckeditor5-utils": "^19.0.0", | ||
"@ckeditor/ckeditor5-core": "^19.0.1", | ||
"@ckeditor/ckeditor5-engine": "^19.0.1", | ||
"@ckeditor/ckeditor5-ui": "^19.0.1", | ||
"@ckeditor/ckeditor5-utils": "^19.0.1", | ||
"lodash-es": "^4.17.10" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-basic-styles": "^19.0.0", | ||
"@ckeditor/ckeditor5-block-quote": "^19.0.0", | ||
"@ckeditor/ckeditor5-clipboard": "^19.0.0", | ||
"@ckeditor/ckeditor5-editor-balloon": "^19.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^19.0.0", | ||
"@ckeditor/ckeditor5-enter": "^19.0.0", | ||
"@ckeditor/ckeditor5-essentials": "^19.0.0", | ||
"@ckeditor/ckeditor5-heading": "^19.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^19.0.0", | ||
"@ckeditor/ckeditor5-table": "^19.0.0", | ||
"@ckeditor/ckeditor5-typing": "^19.0.0", | ||
"@ckeditor/ckeditor5-undo": "^19.0.0", | ||
"eslint": "^5.5.0", | ||
"eslint-config-ckeditor5": "^2.0.0", | ||
"husky": "^1.3.1", | ||
"lint-staged": "^7.0.0", | ||
"stylelint": "^11.1.1", | ||
"stylelint-config-ckeditor5": "^1.0.0" | ||
"@ckeditor/ckeditor5-basic-styles": "^19.0.1", | ||
"@ckeditor/ckeditor5-block-quote": "^19.0.1", | ||
"@ckeditor/ckeditor5-clipboard": "^19.0.1", | ||
"@ckeditor/ckeditor5-editor-balloon": "^19.0.1", | ||
"@ckeditor/ckeditor5-editor-classic": "^19.0.1", | ||
"@ckeditor/ckeditor5-enter": "^19.0.1", | ||
"@ckeditor/ckeditor5-essentials": "^19.0.1", | ||
"@ckeditor/ckeditor5-heading": "^19.0.1", | ||
"@ckeditor/ckeditor5-horizontal-line": "^19.0.1", | ||
"@ckeditor/ckeditor5-media-embed": "^19.1.0", | ||
"@ckeditor/ckeditor5-paragraph": "^19.1.0", | ||
"@ckeditor/ckeditor5-table": "^19.1.0", | ||
"@ckeditor/ckeditor5-typing": "^19.0.1", | ||
"@ckeditor/ckeditor5-undo": "^19.0.1" | ||
}, | ||
@@ -49,3 +45,4 @@ "engines": { | ||
"type": "git", | ||
"url": "https://github.com/ckeditor/ckeditor5-widget.git" | ||
"url": "https://github.com/ckeditor/ckeditor5.git", | ||
"directory": "packages/ckeditor5-widget" | ||
}, | ||
@@ -56,24 +53,3 @@ "files": [ | ||
"theme" | ||
], | ||
"scripts": { | ||
"lint": "eslint --quiet '**/*.js'", | ||
"stylelint": "stylelint --quiet --allow-empty-input 'theme/**/*.css' 'docs/**/*.css'" | ||
}, | ||
"lint-staged": { | ||
"**/*.js": [ | ||
"eslint --quiet" | ||
], | ||
"**/*.css": [ | ||
"stylelint --quiet --allow-empty-input" | ||
] | ||
}, | ||
"eslintIgnore": [ | ||
"src/lib/**", | ||
"packages/**" | ||
], | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
} | ||
] | ||
} |
@@ -5,5 +5,2 @@ CKEditor 5 widget API | ||
[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-widget.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-widget) | ||
[![Build Status](https://travis-ci.org/ckeditor/ckeditor5-widget.svg?branch=master)](https://travis-ci.org/ckeditor/ckeditor5-widget) | ||
[![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5-widget/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5-widget?branch=master) | ||
<br> | ||
[![Dependency Status](https://david-dm.org/ckeditor/ckeditor5-widget/status.svg)](https://david-dm.org/ckeditor/ckeditor5-widget) | ||
@@ -10,0 +7,0 @@ [![devDependency Status](https://david-dm.org/ckeditor/ckeditor5-widget/dev-status.svg)](https://david-dm.org/ckeditor/ckeditor5-widget?type=dev) |
@@ -12,2 +12,5 @@ /** | ||
import IconView from '@ckeditor/ckeditor5-ui/src/icon/iconview'; | ||
import Rect from '@ckeditor/ckeditor5-utils/src/dom/rect'; | ||
import BalloonPanelView from '@ckeditor/ckeditor5-ui/src/panel/balloon/balloonpanelview'; | ||
import global from '@ckeditor/ckeditor5-utils/src/dom/global'; | ||
@@ -343,2 +346,61 @@ import dragHandleIcon from '../theme/icons/drag-handle.svg'; | ||
/** | ||
* A positioning function passed to the {@link module:utils/dom/position~getOptimalPosition} helper as a last resort | ||
* when attaching {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView balloon UI} to widgets. | ||
* It comes in handy when a widget is longer than the visual viewport of the web browser and/or upper/lower boundaries | ||
* of a widget are off screen because of the web page scroll. | ||
* | ||
* ┌─┄┄┄┄┄┄┄┄┄Widget┄┄┄┄┄┄┄┄┄┐ | ||
* ┊ ┊ | ||
* ┌────────────Viewport───────────┐ ┌──╁─────────Viewport────────╁──┐ | ||
* │ ┏━━━━━━━━━━Widget━━━━━━━━━┓ │ │ ┃ ^ ┃ │ | ||
* │ ┃ ^ ┃ │ │ ┃ ╭───────/ \───────╮ ┃ │ | ||
* │ ┃ ╭───────/ \───────╮ ┃ │ │ ┃ │ Balloon │ ┃ │ | ||
* │ ┃ │ Balloon │ ┃ │ │ ┃ ╰─────────────────╯ ┃ │ | ||
* │ ┃ ╰─────────────────╯ ┃ │ │ ┃ ┃ │ | ||
* │ ┃ ┃ │ │ ┃ ┃ │ | ||
* │ ┃ ┃ │ │ ┃ ┃ │ | ||
* │ ┃ ┃ │ │ ┃ ┃ │ | ||
* │ ┃ ┃ │ │ ┃ ┃ │ | ||
* │ ┃ ┃ │ │ ┃ ┃ │ | ||
* │ ┃ ┃ │ │ ┃ ┃ │ | ||
* └──╀─────────────────────────╀──┘ └──╀─────────────────────────╀──┘ | ||
* ┊ ┊ ┊ ┊ | ||
* ┊ ┊ └┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘ | ||
* ┊ ┊ | ||
* └┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘ | ||
* | ||
* **Note**: Works best if used together with | ||
* {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.defaultPositions default `BalloonPanelView` positions} | ||
* like `northArrowSouth` and `southArrowNorth`; the transition between these two and this position is smooth. | ||
* | ||
* @param {module:utils/dom/rect~Rect} widgetRect A rect of the widget. | ||
* @param {module:utils/dom/rect~Rect} balloonRect A rect of the balloon. | ||
* @returns {module:utils/dom/position~Position|null} | ||
*/ | ||
export function centeredBalloonPositionForLongWidgets( widgetRect, balloonRect ) { | ||
const viewportRect = new Rect( global.window ); | ||
const viewportWidgetInsersectionRect = viewportRect.getIntersection( widgetRect ); | ||
const balloonTotalHeight = balloonRect.height + BalloonPanelView.arrowVerticalOffset; | ||
// If there is enough space above or below the widget then this position should not be used. | ||
if ( widgetRect.top - balloonTotalHeight > viewportRect.top || widgetRect.bottom + balloonTotalHeight < viewportRect.bottom ) { | ||
return null; | ||
} | ||
// Because this is a last resort positioning, to keep things simple we're not playing with positions of the arrow | ||
// like, for instance, "south west" or whatever. Just try to keep the balloon in the middle of the visible area of | ||
// the widget for as long as it is possible. If the widgets becomes invisible (because cropped by the viewport), | ||
// just... place the balloon in the middle of it (because why not?). | ||
const targetRect = viewportWidgetInsersectionRect || widgetRect; | ||
const left = targetRect.left + targetRect.width / 2 - balloonRect.width / 2; | ||
return { | ||
top: Math.max( widgetRect.top, 0 ) + BalloonPanelView.arrowVerticalOffset, | ||
left, | ||
name: 'arrow_n' | ||
}; | ||
} | ||
// Default filler offset function applied to all widget elements. | ||
@@ -345,0 +407,0 @@ // |
@@ -12,2 +12,3 @@ /** | ||
import MouseObserver from '@ckeditor/ckeditor5-engine/src/view/observer/mouseobserver'; | ||
import WidgetTypeAround from './widgettypearound/widgettypearound'; | ||
import { getLabel, isWidget, WIDGET_SELECTED_CLASS_NAME } from './utils'; | ||
@@ -45,2 +46,9 @@ import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard'; | ||
*/ | ||
static get requires() { | ||
return [ WidgetTypeAround ]; | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
init() { | ||
@@ -47,0 +55,0 @@ const view = this.editor.editing.view; |
@@ -14,3 +14,6 @@ /** | ||
import BalloonPanelView from '@ckeditor/ckeditor5-ui/src/panel/balloon/balloonpanelview'; | ||
import { isWidget } from './utils'; | ||
import { | ||
isWidget, | ||
centeredBalloonPositionForLongWidgets | ||
} from './utils'; | ||
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; | ||
@@ -276,3 +279,4 @@ | ||
defaultPositions.southArrowNorthWest, | ||
defaultPositions.southArrowNorthEast | ||
defaultPositions.southArrowNorthEast, | ||
centeredBalloonPositionForLongWidgets | ||
] | ||
@@ -279,0 +283,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
156416
14
52
2505
17