acrolinx-sidebar-sdk
Advanced tools
Comparing version 0.4.30 to 0.4.31
@@ -9,8 +9,8 @@ import { Match, MatchWithReplacement, Check, DocumentSelection } from "../acrolinx-libs/plugin-interfaces"; | ||
abstract getEditorDocument(): Document; | ||
abstract getContent(): string; | ||
protected getEditorElement(): Element; | ||
abstract getContent(opts: ExtractContentForCheckOpts): string; | ||
protected getEditorElement(): HTMLElement; | ||
registerCheckCall(_checkInfo: Check): void; | ||
registerCheckResult(_checkResult: SuccessfulCheckResult): void; | ||
extractContentForCheck(opts: ExtractContentForCheckOpts): ContentExtractionResult; | ||
protected getSelection(): DocumentSelection | undefined; | ||
protected getSelection(): DocumentSelection; | ||
private scrollIntoView; | ||
@@ -17,0 +17,0 @@ scrollToCurrentSelection(): void; |
@@ -38,3 +38,3 @@ "use strict"; | ||
AbstractRichtextEditorAdapter.prototype.extractContentForCheck = function (opts) { | ||
var html = this.getContent(); | ||
var html = this.getContent(opts); | ||
this.currentContentChecking = html; | ||
@@ -44,3 +44,3 @@ return { content: html, selection: opts.checkSelection ? this.getSelection() : undefined }; | ||
AbstractRichtextEditorAdapter.prototype.getSelection = function () { | ||
return undefined; | ||
return { ranges: [] }; | ||
}; | ||
@@ -47,0 +47,0 @@ AbstractRichtextEditorAdapter.prototype.scrollIntoView = function (sel) { |
@@ -38,3 +38,3 @@ import { Match, MatchWithReplacement, Check, DocumentSelection, CheckedDocumentPart, CheckInformationKeyValuePair } from "../acrolinx-libs/plugin-interfaces"; | ||
getFormat?(): string; | ||
getContent?(): string; | ||
getContent?(opts: ExtractContentForCheckOpts): string; | ||
extractContentForCheck(opts: ExtractContentForCheckOpts): ContentExtractionResult | Promise<ContentExtractionResult>; | ||
@@ -41,0 +41,0 @@ registerCheckCall(checkInfo: Check): void; |
@@ -5,9 +5,9 @@ import { AbstractRichtextEditorAdapter } from "./AbstractRichtextEditorAdapter"; | ||
export declare class ContentEditableAdapter extends AbstractRichtextEditorAdapter { | ||
element: Element; | ||
element: HTMLElement; | ||
constructor(conf: AdapterConf); | ||
getEditorElement(): Element; | ||
getEditorElement(): HTMLElement; | ||
getContent(): string; | ||
protected getSelection(): DocumentSelection | undefined; | ||
protected getSelection(): DocumentSelection; | ||
getEditorDocument(): Document; | ||
protected scrollElementIntoView(el: HTMLElement): void; | ||
} |
@@ -22,4 +22,3 @@ "use strict"; | ||
var scrolling_1 = require("../utils/scrolling"); | ||
var range_1 = require("../utils/range"); | ||
var _ = require("lodash"); | ||
var check_selection_1 = require("../utils/check-selection"); | ||
var ContentEditableAdapter = /** @class */ (function (_super) { | ||
@@ -39,10 +38,3 @@ tslib_1.__extends(ContentEditableAdapter, _super); | ||
ContentEditableAdapter.prototype.getSelection = function () { | ||
var htmlRanges = range_1.getSelectionHtmlRanges(this.getEditorElement()); | ||
if (_.isEmpty(htmlRanges)) { | ||
return undefined; | ||
} | ||
// console.log('selected content: ', htmlRanges.map(r => this.getContent().slice(r[0], r[1]))); | ||
return { | ||
ranges: htmlRanges | ||
}; | ||
return { ranges: check_selection_1.getSelectionHtmlRanges(this.getEditorElement()) }; | ||
}; | ||
@@ -49,0 +41,0 @@ ContentEditableAdapter.prototype.getEditorDocument = function () { |
import { Editor } from 'tinymce'; | ||
import { AbstractRichtextEditorAdapter } from "./AbstractRichtextEditorAdapter"; | ||
import { HasEditorID } from "./AdapterInterface"; | ||
import { DocumentSelection } from '../acrolinx-libs/plugin-interfaces'; | ||
import { AbstractRichtextEditorAdapter } from './AbstractRichtextEditorAdapter'; | ||
import { ExtractContentForCheckOpts, HasEditorID } from './AdapterInterface'; | ||
export declare class TinyMCEAdapter extends AbstractRichtextEditorAdapter { | ||
@@ -8,5 +9,7 @@ editorId: string; | ||
getEditor(): Editor; | ||
getContent(): string; | ||
getContent(opts: ExtractContentForCheckOpts): string; | ||
getContentForCheckSelection: (el: HTMLElement) => string; | ||
protected getSelection(): DocumentSelection; | ||
getEditorDocument(): Document; | ||
scrollToCurrentSelection(): void; | ||
} |
@@ -19,2 +19,3 @@ "use strict"; | ||
var tslib_1 = require("tslib"); | ||
var check_selection_1 = require("../utils/check-selection"); | ||
var AbstractRichtextEditorAdapter_1 = require("./AbstractRichtextEditorAdapter"); | ||
@@ -25,2 +26,5 @@ var TinyMCEAdapter = /** @class */ (function (_super) { | ||
var _this = _super.call(this, conf) || this; | ||
_this.getContentForCheckSelection = function (el) { | ||
return _this.getEditor().serializer.serialize(el, {}); | ||
}; | ||
_this.editorId = conf.editorId; | ||
@@ -32,5 +36,13 @@ return _this; | ||
}; | ||
TinyMCEAdapter.prototype.getContent = function () { | ||
return this.getEditor().getContent(); | ||
TinyMCEAdapter.prototype.getContent = function (opts) { | ||
if (opts.checkSelection) { | ||
return this.getContentForCheckSelection(this.getEditorElement()); | ||
} | ||
else { | ||
return this.getEditor().getContent({}); | ||
} | ||
}; | ||
TinyMCEAdapter.prototype.getSelection = function () { | ||
return { ranges: check_selection_1.getSelectionHtmlRanges(this.getEditorElement(), this.getContentForCheckSelection) }; | ||
}; | ||
TinyMCEAdapter.prototype.getEditorDocument = function () { | ||
@@ -46,2 +58,3 @@ return this.getEditor().getDoc(); | ||
selection.collapseToStart(); | ||
// TODO: Does this line cause a failing selection in IE11 sometimes? | ||
this.getEditor().insertContent(''); | ||
@@ -48,0 +61,0 @@ var restoredRange = this.getEditorDocument().createRange(); |
@@ -13,3 +13,3 @@ import { AcrolinxPlugin, autoBindFloatingSidebar } from "./acrolinx-plugin"; | ||
import { loadSidebarCode } from "./utils/sidebar-loader"; | ||
import { getSelectionHtmlRanges } from "./utils/range"; | ||
import { getSelectionHtmlRanges } from "./utils/check-selection"; | ||
import { lookupMatches } from "./lookup/diff-based"; | ||
@@ -16,0 +16,0 @@ import { extractTextDomMapping } from "./utils/text-dom-mapping"; |
@@ -30,3 +30,3 @@ "use strict"; | ||
var sidebar_loader_1 = require("./utils/sidebar-loader"); | ||
var range_1 = require("./utils/range"); | ||
var check_selection_1 = require("./utils/check-selection"); | ||
var diff_based_1 = require("./lookup/diff-based"); | ||
@@ -47,3 +47,3 @@ var text_dom_mapping_1 = require("./utils/text-dom-mapping"); | ||
loadSidebarCode: sidebar_loader_1.loadSidebarCode, | ||
getSelectionHtmlRanges: range_1.getSelectionHtmlRanges, | ||
getSelectionHtmlRanges: check_selection_1.getSelectionHtmlRanges, | ||
adapter: { | ||
@@ -50,0 +50,0 @@ AbstractRichtextEditorAdapter: AbstractRichtextEditorAdapter_1.AbstractRichtextEditorAdapter, |
@@ -14,3 +14,3 @@ export { AcrolinxPlugin, autoBindFloatingSidebar } from "./acrolinx-plugin"; | ||
export { loadSidebarCode } from "./utils/sidebar-loader"; | ||
export { getSelectionHtmlRanges } from "./utils/range"; | ||
export { getSelectionHtmlRanges } from "./utils/check-selection"; | ||
export { lookupMatches } from "./lookup/diff-based"; | ||
@@ -17,0 +17,0 @@ export { extractTextDomMapping } from "./utils/text-dom-mapping"; |
@@ -43,4 +43,4 @@ "use strict"; | ||
exports.loadSidebarCode = sidebar_loader_1.loadSidebarCode; | ||
var range_1 = require("./utils/range"); | ||
exports.getSelectionHtmlRanges = range_1.getSelectionHtmlRanges; | ||
var check_selection_1 = require("./utils/check-selection"); | ||
exports.getSelectionHtmlRanges = check_selection_1.getSelectionHtmlRanges; | ||
var diff_based_1 = require("./lookup/diff-based"); | ||
@@ -47,0 +47,0 @@ exports.lookupMatches = diff_based_1.lookupMatches; |
{ | ||
"name": "acrolinx-sidebar-sdk", | ||
"description": "Acrolinx Sidebar SDK for JavaScript", | ||
"version": "0.4.30", | ||
"version": "0.4.31", | ||
"license": "Apache-2.0", | ||
@@ -19,9 +19,9 @@ "author": "Acrolinx", | ||
"dependencies": { | ||
"@types/ckeditor": "4.9.5", | ||
"@types/codemirror": "0.0.71", | ||
"@types/ckeditor": "4.9.7", | ||
"@types/codemirror": "0.0.72", | ||
"@types/diff-match-patch": "^1.0.31", | ||
"@types/tinymce": "^4.5.16", | ||
"@types/tinymce": "^4.5.19", | ||
"acrolinx-sidebar-startpage": "^2.0.6", | ||
"diff-match-patch": "1.0.4", | ||
"es6-promise": "^4.2.5", | ||
"es6-promise": "^4.2.6", | ||
"lodash": "^4.17.11", | ||
@@ -33,9 +33,9 @@ "tslib": "^1.9.3" | ||
"@types/jquery": "^3.3.29", | ||
"@types/lodash": "4.14.119", | ||
"@types/mocha": "5.2.5", | ||
"@types/lodash": "4.14.122", | ||
"@types/mocha": "5.2.6", | ||
"browserify": "^16.2.3", | ||
"browserify-istanbul": "3.0.1", | ||
"chai": "^4.2.0", | ||
"ckeditor": "4.11.1", | ||
"codemirror": "^5.42.2", | ||
"ckeditor": "4.11.3", | ||
"codemirror": "^5.44.0", | ||
"dts-bundle": "^0.7.3", | ||
@@ -45,3 +45,3 @@ "istanbul": "^0.4.5", | ||
"jsverify": "^0.8.3", | ||
"karma": "^3.1.4", | ||
"karma": "^4.0.1", | ||
"karma-browserify": "^6.0.0", | ||
@@ -57,16 +57,17 @@ "karma-browserstack-launcher": "^1.4.0", | ||
"phantomjs-prebuilt": "2.1.16", | ||
"tinymce": "^4.9.2", | ||
"tinymce": "^4.9.3", | ||
"ts-loader": "^5.3.3", | ||
"tslint": "5.12.0", | ||
"typedoc": "0.13.0", | ||
"typescript": "3.2.2", | ||
"typescript": "3.3.3333", | ||
"uglify-js": "^3.4.9", | ||
"webpack": "^4.28.1", | ||
"webpack-cli": "^3.2.1", | ||
"webpack-dev-server": "^3.1.14" | ||
"webpack": "^4.29.6", | ||
"webpack-cli": "^3.2.3", | ||
"webpack-dev-server": "^3.2.1" | ||
}, | ||
"scripts": { | ||
"clean": "rm -rf tmp dist", | ||
"buildDoc": "typedoc --out ./docs/pluginDoc/ src/", | ||
"buildLocal": "npm run tsc && npm run tslint && npm run webpack && npm run test && npm run dist", | ||
"jenkins": "npm run tsc && npm run tslint && npm run webpack && npm run test && npm run testKarmaBsJenkins && npm run dist", | ||
"buildLocal": "npm run tsc && npm run tslint && npm run webpack && npm run test && npm run dist", | ||
"jenkins": "npm run tsc && npm run tslint && npm run webpack && npm run test && npm run dist", | ||
"dist": "cp -r tmp/compiled/src/* dist && npm run minify", | ||
@@ -73,0 +74,0 @@ "minify": "uglifyjs dist/acrolinx-sidebar-sdk.js -o dist/acrolinx-sidebar-sdk.min.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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 too big to display
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
1797960
5840
+ Added@types/ckeditor@4.9.7(transitive)
+ Added@types/codemirror@0.0.72(transitive)
- Removed@types/ckeditor@4.9.5(transitive)
- Removed@types/codemirror@0.0.71(transitive)
Updated@types/ckeditor@4.9.7
Updated@types/codemirror@0.0.72
Updated@types/tinymce@^4.5.19
Updatedes6-promise@^4.2.6