@ckeditor/ckeditor5-typing
Advanced tools
Comparing version 31.0.0 to 31.1.0
{ | ||
"name": "@ckeditor/ckeditor5-typing", | ||
"version": "31.0.0", | ||
"version": "31.1.0", | ||
"description": "Typing feature for CKEditor 5.", | ||
@@ -15,20 +15,20 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "^31.0.0", | ||
"@ckeditor/ckeditor5-engine": "^31.0.0", | ||
"@ckeditor/ckeditor5-utils": "^31.0.0", | ||
"@ckeditor/ckeditor5-core": "^31.1.0", | ||
"@ckeditor/ckeditor5-engine": "^31.1.0", | ||
"@ckeditor/ckeditor5-utils": "^31.1.0", | ||
"lodash-es": "^4.17.15" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-basic-styles": "^31.0.0", | ||
"@ckeditor/ckeditor5-block-quote": "^31.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^31.0.0", | ||
"@ckeditor/ckeditor5-enter": "^31.0.0", | ||
"@ckeditor/ckeditor5-essentials": "^31.0.0", | ||
"@ckeditor/ckeditor5-heading": "^31.0.0", | ||
"@ckeditor/ckeditor5-image": "^31.0.0", | ||
"@ckeditor/ckeditor5-link": "^31.0.0", | ||
"@ckeditor/ckeditor5-list": "^31.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^31.0.0", | ||
"@ckeditor/ckeditor5-undo": "^31.0.0", | ||
"@ckeditor/ckeditor5-code-block": "^31.0.0" | ||
"@ckeditor/ckeditor5-basic-styles": "^31.1.0", | ||
"@ckeditor/ckeditor5-block-quote": "^31.1.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^31.1.0", | ||
"@ckeditor/ckeditor5-enter": "^31.1.0", | ||
"@ckeditor/ckeditor5-essentials": "^31.1.0", | ||
"@ckeditor/ckeditor5-heading": "^31.1.0", | ||
"@ckeditor/ckeditor5-image": "^31.1.0", | ||
"@ckeditor/ckeditor5-link": "^31.1.0", | ||
"@ckeditor/ckeditor5-list": "^31.1.0", | ||
"@ckeditor/ckeditor5-paragraph": "^31.1.0", | ||
"@ckeditor/ckeditor5-undo": "^31.1.0", | ||
"@ckeditor/ckeditor5-code-block": "^31.1.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "engines": { |
@@ -15,2 +15,3 @@ /** | ||
import env from '@ckeditor/ckeditor5-utils/src/env'; | ||
import { isShiftDeleteOnNonCollapsedSelection } from './utils/utils'; | ||
@@ -39,2 +40,11 @@ /** | ||
document.on( 'keydown', ( evt, data ) => { | ||
// Do not fire the `delete` event, if Shift + Delete key combination was pressed on a non-collapsed selection on Windows. | ||
// | ||
// The Shift + Delete key combination should work in the same way as the `cut` event on a non-collapsed selection on Windows. | ||
// In fact, the native `cut` event is actually emitted in this case, but with lower priority. Therefore, in order to handle the | ||
// Shift + Delete key combination correctly, it is enough not to emit the `delete` event. | ||
if ( env.isWindows && isShiftDeleteOnNonCollapsedSelection( data, document ) ) { | ||
return; | ||
} | ||
const deleteData = {}; | ||
@@ -41,0 +51,0 @@ |
@@ -12,2 +12,3 @@ /** | ||
import env from '@ckeditor/ckeditor5-utils/src/env'; | ||
import { isShiftDeleteOnNonCollapsedSelection } from './utils'; | ||
@@ -53,2 +54,11 @@ /** | ||
function handleUnsafeKeystroke( evtData ) { | ||
// Do not delete the content, if Shift + Delete key combination was pressed on a non-collapsed selection on Windows. | ||
// | ||
// The Shift + Delete key combination should work in the same way as the `cut` event on a non-collapsed selection on Windows. | ||
// In fact, the native `cut` event is actually emitted in this case, but with lower priority. Therefore, in order to handle the | ||
// Shift + Delete key combination correctly, it is enough to prevent the content deletion here. | ||
if ( env.isWindows && isShiftDeleteOnNonCollapsedSelection( evtData, view.document ) ) { | ||
return; | ||
} | ||
const doc = model.document; | ||
@@ -55,0 +65,0 @@ const isComposing = view.document.isComposing; |
@@ -12,2 +12,3 @@ /** | ||
import diffToChanges from '@ckeditor/ckeditor5-utils/src/difftochanges'; | ||
import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard'; | ||
@@ -87,1 +88,19 @@ /** | ||
} | ||
/** | ||
* Checks if <kbd>Shift</kbd> + <kbd>Delete</kbd> keystroke was pressed on a non-collapsed selection. | ||
* | ||
* This key combination has a special meaning on Windows machines and it should work in the same way as the `cut` event on a non-collapsed | ||
* selection. | ||
* | ||
* @param {module:engine/view/observer/domeventdata~DomEventData} domEventData Event data. | ||
* @param {module:engine/view/document~Document} document The document instance on which the event has been fired. | ||
* @returns {Boolean} | ||
*/ | ||
export function isShiftDeleteOnNonCollapsedSelection( domEventData, document ) { | ||
const selection = document.selection; | ||
const isShiftDelete = domEventData.shiftKey && domEventData.keyCode === keyCodes.delete; | ||
const isNonCollapsedSelection = !selection.isCollapsed; | ||
return isShiftDelete && isNonCollapsedSelection; | ||
} |
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
102773
2516