@ckeditor/ckeditor5-paste-from-office
Advanced tools
Comparing version 0.0.1 to 10.0.0
{ | ||
"name": "@ckeditor/ckeditor5-paste-from-office", | ||
"version": "0.0.1", | ||
"version": "10.0.0", | ||
"description": "Paste from Office feature for CKEditor 5.", | ||
@@ -10,21 +10,24 @@ "keywords": [ | ||
"ckeditor5-feature", | ||
"paste from Word", | ||
"paste from Office" | ||
"ckeditor5-plugin" | ||
], | ||
"dependencies": {}, | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-clipboard": "^10.0.4", | ||
"@ckeditor/ckeditor5-core": "^11.1.0", | ||
"@ckeditor/ckeditor5-engine": "^12.0.0" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-basic-styles": "^10.0.3", | ||
"@ckeditor/ckeditor5-clipboard": "^10.0.3", | ||
"@ckeditor/ckeditor5-core": "^11.0.1", | ||
"@ckeditor/ckeditor5-editor-classic": "^11.0.1", | ||
"@ckeditor/ckeditor5-engine": "^11.0.0", | ||
"@ckeditor/ckeditor5-enter": "^10.1.2", | ||
"@ckeditor/ckeditor5-heading": "^10.1.0", | ||
"@ckeditor/ckeditor5-link": "^10.0.4", | ||
"@ckeditor/ckeditor5-list": "^11.0.2", | ||
"@ckeditor/ckeditor5-paragraph": "^10.0.3", | ||
"@ckeditor/ckeditor5-table": "^11.0.0", | ||
"@ckeditor/ckeditor5-utils": "^11.0.0", | ||
"@ckeditor/ckeditor5-basic-styles": "^10.1.0", | ||
"@ckeditor/ckeditor5-cloud-services": "^10.1.1", | ||
"@ckeditor/ckeditor5-easy-image": "^10.0.4", | ||
"@ckeditor/ckeditor5-editor-classic": "^11.0.2", | ||
"@ckeditor/ckeditor5-enter": "^10.1.3", | ||
"@ckeditor/ckeditor5-heading": "^10.1.1", | ||
"@ckeditor/ckeditor5-image": "^12.0.0", | ||
"@ckeditor/ckeditor5-link": "^10.1.0", | ||
"@ckeditor/ckeditor5-list": "^11.0.3", | ||
"@ckeditor/ckeditor5-paragraph": "^10.0.4", | ||
"@ckeditor/ckeditor5-table": "^11.0.1", | ||
"@ckeditor/ckeditor5-utils": "^11.1.0", | ||
"eslint": "^5.5.0", | ||
"eslint-config-ckeditor5": "^1.0.8", | ||
"eslint-config-ckeditor5": "^1.0.7", | ||
"husky": "^0.14.3", | ||
@@ -40,9 +43,12 @@ "lint-staged": "^7.0.0" | ||
"homepage": "https://ckeditor.com", | ||
"bugs": { | ||
"url": "https://github.com/ckeditor/ckeditor5-paste-from-office/issues" | ||
}, | ||
"bugs": "https://github.com/ckeditor/ckeditor5-paste-from-office/issues", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ckeditor/ckeditor5-paste-from-office.git" | ||
"url": "https://github.com/ckeditor/ckeditor5-paste-from-office.git" | ||
}, | ||
"files": [ | ||
"lang", | ||
"src", | ||
"theme" | ||
], | ||
"scripts": { | ||
@@ -49,0 +55,0 @@ "lint": "eslint --quiet '**/*.js'", |
@@ -12,3 +12,2 @@ /** | ||
import Matcher from '@ckeditor/ckeditor5-engine/src/view/matcher'; | ||
import Range from '@ckeditor/ckeditor5-engine/src/view/range'; | ||
import UpcastWriter from '@ckeditor/ckeditor5-engine/src/view/upcastwriter'; | ||
@@ -32,3 +31,4 @@ | ||
const itemLikeElements = findAllItemLikeElements( documentFragment ); | ||
const writer = new UpcastWriter(); | ||
const itemLikeElements = findAllItemLikeElements( documentFragment, writer ); | ||
@@ -39,4 +39,2 @@ if ( !itemLikeElements.length ) { | ||
const writer = new UpcastWriter(); | ||
let currentList = null; | ||
@@ -61,2 +59,3 @@ | ||
// in which to look for list-like nodes. | ||
// @param {module:engine/view/upcastwriter~UpcastWriter} writer | ||
// @returns {Array.<Object>} Array of found list-like items. Each item is an object containing: | ||
@@ -68,4 +67,4 @@ // | ||
// * {Number} indent List item indentation level parsed from `mso-list` style (see `getListItemData()` function). | ||
function findAllItemLikeElements( documentFragment ) { | ||
const range = Range.createIn( documentFragment ); | ||
function findAllItemLikeElements( documentFragment, writer ) { | ||
const range = writer.createRangeIn( documentFragment ); | ||
@@ -210,3 +209,3 @@ // Matcher for finding list-like elements. | ||
const range = Range.createIn( element ); | ||
const range = writer.createRangeIn( element ); | ||
@@ -213,0 +212,0 @@ for ( const value of range ) { |
@@ -13,4 +13,5 @@ /** | ||
import { parseHtml } from './filters/utils'; | ||
import { parseHtml } from './filters/parse'; | ||
import { transformListItemLikeElementsIntoLists } from './filters/list'; | ||
import { replaceImagesSourceWithBase64 } from './filters/image'; | ||
@@ -44,4 +45,7 @@ /** | ||
if ( isWordInput( html ) ) { | ||
data.content = this._normalizeWordInput( html ); | ||
if ( data.pasteFromOfficeProcessed !== true && isWordInput( html ) ) { | ||
data.content = this._normalizeWordInput( html, data.dataTransfer ); | ||
// Set the flag so if `inputTransformation` is re-fired, PFO will not process it again (#44). | ||
data.pasteFromOfficeProcessed = true; | ||
} | ||
@@ -58,7 +62,10 @@ }, { priority: 'high' } ); | ||
* @param {String} input Word input. | ||
* @param {module:clipboard/datatransfer~DataTransfer} dataTransfer Data transfer instance. | ||
* @returns {module:engine/view/documentfragment~DocumentFragment} Normalized input. | ||
*/ | ||
_normalizeWordInput( input ) { | ||
_normalizeWordInput( input, dataTransfer ) { | ||
const { body, stylesString } = parseHtml( input ); | ||
transformListItemLikeElementsIntoLists( body, stylesString ); | ||
replaceImagesSourceWithBase64( body, dataTransfer.getData( 'text/rtf' ) ); | ||
@@ -74,3 +81,4 @@ return body; | ||
function isWordInput( html ) { | ||
return !!( html && html.match( /<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>/gi ) ); | ||
return !!( html && ( html.match( /<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>/gi ) || | ||
html.match( /xmlns:o="urn:schemas-microsoft-com/gi ) ) ); | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
31236
3
9
576
1
1
+ Added@ckeditor/ckeditor5-clipboard@10.0.4(transitive)
+ Added@ckeditor/ckeditor5-core@11.1.0(transitive)
+ Added@ckeditor/ckeditor5-engine@12.0.0(transitive)
+ Added@ckeditor/ckeditor5-utils@11.1.0(transitive)
+ Addedckeditor5@11.2.0(transitive)
+ Addedlodash-es@4.17.21(transitive)