@acrolinx/sidebar-sdk 1.1.13 → 2.0.0-dev1

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.
Files changed (122) hide show
  1. package/README.md +22 -22
  2. package/dist/index.d.ts +612 -23
  3. package/dist/index.js +3325 -64
  4. package/package.json +44 -90
  5. package/dist/acrolinx-plugin.d.ts +0 -58
  6. package/dist/acrolinx-plugin.js +0 -318
  7. package/dist/acrolinx-plugin.js.map +0 -1
  8. package/dist/acrolinx-sidebar-sdk.js +0 -2
  9. package/dist/acrolinx-sidebar-sdk.js.LICENSE.txt +0 -16
  10. package/dist/acrolinx-sidebar-sdk.min.js +0 -1
  11. package/dist/adapters/AbstractRichtextEditorAdapter.d.ts +0 -35
  12. package/dist/adapters/AbstractRichtextEditorAdapter.js +0 -267
  13. package/dist/adapters/AbstractRichtextEditorAdapter.js.map +0 -1
  14. package/dist/adapters/AdapterInterface.d.ts +0 -63
  15. package/dist/adapters/AdapterInterface.js +0 -51
  16. package/dist/adapters/AdapterInterface.js.map +0 -1
  17. package/dist/adapters/AsyncAutoBindAdapter.d.ts +0 -18
  18. package/dist/adapters/AsyncAutoBindAdapter.js +0 -77
  19. package/dist/adapters/AsyncAutoBindAdapter.js.map +0 -1
  20. package/dist/adapters/AsyncContentEditableAdapter.d.ts +0 -22
  21. package/dist/adapters/AsyncContentEditableAdapter.js +0 -135
  22. package/dist/adapters/AsyncContentEditableAdapter.js.map +0 -1
  23. package/dist/adapters/AsyncMultiEditorAdapter.d.ts +0 -11
  24. package/dist/adapters/AsyncMultiEditorAdapter.js +0 -97
  25. package/dist/adapters/AsyncMultiEditorAdapter.js.map +0 -1
  26. package/dist/adapters/AutoBindAdapter.d.ts +0 -16
  27. package/dist/adapters/AutoBindAdapter.js +0 -56
  28. package/dist/adapters/AutoBindAdapter.js.map +0 -1
  29. package/dist/adapters/CKEditor5Adapter.d.ts +0 -16
  30. package/dist/adapters/CKEditor5Adapter.js +0 -86
  31. package/dist/adapters/CKEditor5Adapter.js.map +0 -1
  32. package/dist/adapters/CKEditorAdapter.d.ts +0 -14
  33. package/dist/adapters/CKEditorAdapter.js +0 -72
  34. package/dist/adapters/CKEditorAdapter.js.map +0 -1
  35. package/dist/adapters/CodeMirror6Adapter.d.ts +0 -29
  36. package/dist/adapters/CodeMirror6Adapter.js +0 -123
  37. package/dist/adapters/CodeMirror6Adapter.js.map +0 -1
  38. package/dist/adapters/CodeMirrorAdapter.d.ts +0 -31
  39. package/dist/adapters/CodeMirrorAdapter.js +0 -143
  40. package/dist/adapters/CodeMirrorAdapter.js.map +0 -1
  41. package/dist/adapters/ContentEditableAdapter.d.ts +0 -11
  42. package/dist/adapters/ContentEditableAdapter.js +0 -45
  43. package/dist/adapters/ContentEditableAdapter.js.map +0 -1
  44. package/dist/adapters/InputAdapter.d.ts +0 -28
  45. package/dist/adapters/InputAdapter.js +0 -125
  46. package/dist/adapters/InputAdapter.js.map +0 -1
  47. package/dist/adapters/MultiEditorAdapter.d.ts +0 -56
  48. package/dist/adapters/MultiEditorAdapter.js +0 -184
  49. package/dist/adapters/MultiEditorAdapter.js.map +0 -1
  50. package/dist/adapters/QuipAdapter.d.ts +0 -16
  51. package/dist/adapters/QuipAdapter.js +0 -148
  52. package/dist/adapters/QuipAdapter.js.map +0 -1
  53. package/dist/adapters/SynchronizeAsyncAdapter.d.ts +0 -22
  54. package/dist/adapters/SynchronizeAsyncAdapter.js +0 -67
  55. package/dist/adapters/SynchronizeAsyncAdapter.js.map +0 -1
  56. package/dist/adapters/TinyMCEAdapter.d.ts +0 -13
  57. package/dist/adapters/TinyMCEAdapter.js +0 -51
  58. package/dist/adapters/TinyMCEAdapter.js.map +0 -1
  59. package/dist/adapters/TinyMCEWordpressAdapter.d.ts +0 -10
  60. package/dist/adapters/TinyMCEWordpressAdapter.js +0 -78
  61. package/dist/adapters/TinyMCEWordpressAdapter.js.map +0 -1
  62. package/dist/adapters/XeditorAdapter.d.ts +0 -130
  63. package/dist/adapters/XeditorAdapter.js +0 -232
  64. package/dist/adapters/XeditorAdapter.js.map +0 -1
  65. package/dist/autobind/autobind.d.ts +0 -8
  66. package/dist/autobind/autobind.js +0 -120
  67. package/dist/autobind/autobind.js.map +0 -1
  68. package/dist/export-for-browser.d.ts +0 -57
  69. package/dist/export-for-browser.js +0 -73
  70. package/dist/export-for-browser.js.map +0 -1
  71. package/dist/floating-sidebar/async-storage.d.ts +0 -11
  72. package/dist/floating-sidebar/async-storage.js +0 -49
  73. package/dist/floating-sidebar/async-storage.js.map +0 -1
  74. package/dist/floating-sidebar/floating-sidebar.d.ts +0 -41
  75. package/dist/floating-sidebar/floating-sidebar.js +0 -234
  76. package/dist/floating-sidebar/floating-sidebar.js.map +0 -1
  77. package/dist/index.js.map +0 -1
  78. package/dist/lookup/diff-based.d.ts +0 -19
  79. package/dist/lookup/diff-based.js +0 -102
  80. package/dist/lookup/diff-based.js.map +0 -1
  81. package/dist/message-adapter/message-adapter.d.ts +0 -10
  82. package/dist/message-adapter/message-adapter.js +0 -109
  83. package/dist/message-adapter/message-adapter.js.map +0 -1
  84. package/dist/utils/adapter-utils.d.ts +0 -2
  85. package/dist/utils/adapter-utils.js +0 -36
  86. package/dist/utils/adapter-utils.js.map +0 -1
  87. package/dist/utils/alignment.d.ts +0 -11
  88. package/dist/utils/alignment.js +0 -32
  89. package/dist/utils/alignment.js.map +0 -1
  90. package/dist/utils/check-selection.d.ts +0 -3
  91. package/dist/utils/check-selection.js +0 -123
  92. package/dist/utils/check-selection.js.map +0 -1
  93. package/dist/utils/detect-browser.d.ts +0 -6
  94. package/dist/utils/detect-browser.js +0 -71
  95. package/dist/utils/detect-browser.js.map +0 -1
  96. package/dist/utils/escaping.d.ts +0 -6
  97. package/dist/utils/escaping.js +0 -46
  98. package/dist/utils/escaping.js.map +0 -1
  99. package/dist/utils/logging.d.ts +0 -2
  100. package/dist/utils/logging.js +0 -34
  101. package/dist/utils/logging.js.map +0 -1
  102. package/dist/utils/match.d.ts +0 -10
  103. package/dist/utils/match.js +0 -33
  104. package/dist/utils/match.js.map +0 -1
  105. package/dist/utils/scrolling.d.ts +0 -6
  106. package/dist/utils/scrolling.js +0 -92
  107. package/dist/utils/scrolling.js.map +0 -1
  108. package/dist/utils/sidebar-loader.d.ts +0 -19
  109. package/dist/utils/sidebar-loader.js +0 -157
  110. package/dist/utils/sidebar-loader.js.map +0 -1
  111. package/dist/utils/text-dom-mapping.d.ts +0 -13
  112. package/dist/utils/text-dom-mapping.js +0 -90
  113. package/dist/utils/text-dom-mapping.js.map +0 -1
  114. package/dist/utils/text-extraction.d.ts +0 -8
  115. package/dist/utils/text-extraction.js +0 -60
  116. package/dist/utils/text-extraction.js.map +0 -1
  117. package/dist/utils/utils.d.ts +0 -39
  118. package/dist/utils/utils.js +0 -155
  119. package/dist/utils/utils.js.map +0 -1
  120. package/dist/utils/work-queue.d.ts +0 -7
  121. package/dist/utils/work-queue.js +0 -66
  122. package/dist/utils/work-queue.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,23 +1,612 @@
1
- export { AcrolinxPlugin, autoBindFloatingSidebar } from './acrolinx-plugin';
2
- export { AdapterInterface, AsyncAdapterInterface, CommonAdapterInterface } from './adapters/AdapterInterface';
3
- export { InputAdapter } from './adapters/InputAdapter';
4
- export { ContentEditableAdapter } from './adapters/ContentEditableAdapter';
5
- export { AsyncContentEditableAdapter as StateBasedContentEditableAdapter } from './adapters/AsyncContentEditableAdapter';
6
- export { AbstractRichtextEditorAdapter } from './adapters/AbstractRichtextEditorAdapter';
7
- export { CKEditorAdapter } from './adapters/CKEditorAdapter';
8
- export { CKEditor5Adapter } from './adapters/CKEditor5Adapter';
9
- export { TinyMCEAdapter } from './adapters/TinyMCEAdapter';
10
- export { TinyMCEWordpressAdapter } from './adapters/TinyMCEWordpressAdapter';
11
- export { AutoBindAdapter } from './adapters/AutoBindAdapter';
12
- export { AsyncAutoBindAdapter } from './adapters/AsyncAutoBindAdapter';
13
- export { MultiEditorAdapter } from './adapters/MultiEditorAdapter';
14
- export { AsyncMultiEditorAdapter } from './adapters/AsyncMultiEditorAdapter';
15
- export { createPluginMessageAdapter } from './message-adapter/message-adapter';
16
- export { loadSidebarCode } from './utils/sidebar-loader';
17
- export { getSelectionHtmlRanges } from './utils/check-selection';
18
- export { lookupMatches } from './lookup/diff-based';
19
- export { extractTextDomMapping } from './utils/text-dom-mapping';
20
- export { CodeMirrorAdapter } from './adapters/CodeMirrorAdapter';
21
- export { CodeMirror6Adapter } from './adapters/CodeMirror6Adapter';
22
- export { initFloatingSidebar } from './floating-sidebar/floating-sidebar';
23
- export { AsyncLocalStorage } from './floating-sidebar/async-storage';
1
+ import { AcrolinxPlugin as AcrolinxPlugin_2 } from '@acrolinx/sidebar-interface';
2
+ import { AcrolinxStorage } from '@acrolinx/sidebar-interface';
3
+ import { Check } from '@acrolinx/sidebar-interface';
4
+ import { CheckedDocumentPart } from '@acrolinx/sidebar-interface';
5
+ import { CheckInformationKeyValuePair } from '@acrolinx/sidebar-interface';
6
+ import { CheckResult } from '@acrolinx/sidebar-interface';
7
+ import { default as default_2 } from '@ckeditor/ckeditor5-build-inline';
8
+ import { DocumentSelection } from '@acrolinx/sidebar-interface';
9
+ import { Editor } from 'tinymce';
10
+ import { EditorView } from '@codemirror/view';
11
+ import { ExternalContent } from '@acrolinx/sidebar-interface';
12
+ import { InitParameters } from '@acrolinx/sidebar-interface';
13
+ import { InitResult } from '@acrolinx/sidebar-interface';
14
+ import { LogEntry } from '@acrolinx/sidebar-interface';
15
+ import { Match } from '@acrolinx/sidebar-interface';
16
+ import { MatchWithReplacement } from '@acrolinx/sidebar-interface';
17
+ import { Message } from '@acrolinx/sidebar-interface';
18
+ import { SidebarConfiguration } from '@acrolinx/sidebar-interface';
19
+
20
+ export declare abstract class AbstractRichtextEditorAdapter implements AdapterInterface {
21
+ config: AdapterConf;
22
+ currentContentChecking?: string;
23
+ lastContentChecked?: string;
24
+ protected constructor(conf: AdapterConf);
25
+ abstract getEditorDocument(): Document;
26
+ abstract getContent(opts: ExtractContentForCheckOpts): string;
27
+ protected getEditorElement(): HTMLElement;
28
+ registerCheckCall(_checkInfo: Check): void;
29
+ registerCheckResult(_checkResult: SuccessfulCheckResult): void;
30
+ extractContentForCheck(opts: ExtractContentForCheckOpts): ContentExtractionResult | Promise<ContentExtractionResult>;
31
+ protected getSelection(): DocumentSelection;
32
+ protected scrollIntoView(sel: Selection): void | Promise<void>;
33
+ scrollToCurrentSelection(): void;
34
+ protected scrollElementIntoView(el: HTMLElement): void;
35
+ selectRanges(checkId: string, matches: Match[]): void;
36
+ protected isCkEditor5(): boolean;
37
+ protected isQuillEditor(): boolean;
38
+ protected selectMatches<T extends Match>(_checkId: string, matches: T[]): [AlignedMatch<T>[], TextMapping];
39
+ protected selectAlignedMatches(matches: AlignedMatch<Match>[], textMapping: TextMapping): void;
40
+ protected selectText(begin: number, length: number, textMapping: TextMapping): void;
41
+ protected createRange(begin: number, length: number, textMapping: TextMapping): Range;
42
+ protected replaceAlignedMatches(matches: AlignedMatch<MatchWithReplacement>[]): void;
43
+ replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): void;
44
+ protected getTextDomMapping(): TextDomMapping;
45
+ getAutobindWrapperAttributes(): AutobindWrapperAttributes;
46
+ }
47
+
48
+ export declare class AcrolinxPlugin {
49
+ private readonly initConfig;
50
+ private adapter?;
51
+ private config;
52
+ private internalPlugin?;
53
+ constructor(conf: AcrolinxPluginConfig);
54
+ registerAdapter(adapter: AdapterInterface): void;
55
+ configure(conf: SidebarConfiguration): void;
56
+ check(): void;
57
+ /**
58
+ * Show a message in the Sidebar.
59
+ * Supported since Acrolinx Platform 2021.2 (Sidebar version 14.28).
60
+ * @param message The message to show.
61
+ */
62
+ showMessage(message: Message): void;
63
+ init(): Promise<void>;
64
+ dispose(callback: () => void): void;
65
+ }
66
+
67
+ export declare interface AcrolinxPluginConfig extends InitParameters {
68
+ sidebarContainerId: string;
69
+ sidebarUrl?: string;
70
+ sidebarHtml?: string;
71
+ checkSelection?: boolean;
72
+ useMessageAdapter?: boolean;
73
+ useSidebarFromSameOriginDirectly?: boolean;
74
+ onSidebarWindowLoaded?: (sidebarWindow: Window) => void;
75
+ getDocumentReference?: () => string;
76
+ acrolinxStorage?: AcrolinxStorage;
77
+ onEmbedCheckData?: (checkData: CheckInformationKeyValuePair[], format: string) => void;
78
+ onInitFinished?: (initFinishedResult: InitResult) => void;
79
+ onCheckResult?: (checkResult: CheckResult) => void;
80
+ openLogFile?: () => void;
81
+ openWindow?: (url: string) => void;
82
+ log?: (logEntry: LogEntry) => void;
83
+ }
84
+
85
+ export declare interface AcrolinxSidebarIntegration {
86
+ AcrolinxPlugin: typeof AcrolinxPlugin;
87
+ autoBindFloatingSidebar: typeof autoBindFloatingSidebar;
88
+ autoBindFloatingSidebarAsync: typeof autoBindFloatingSidebarAsync;
89
+ initFloatingSidebar: typeof initFloatingSidebar;
90
+ AsyncLocalStorage: typeof AsyncLocalStorage;
91
+ createPluginMessageAdapter: typeof createPluginMessageAdapter;
92
+ loadSidebarCode: typeof loadSidebarCode;
93
+ getSelectionHtmlRanges: typeof getSelectionHtmlRanges;
94
+ adapter: {
95
+ AbstractRichtextEditorAdapter: typeof AbstractRichtextEditorAdapter;
96
+ AutoBindAdapter: typeof AutoBindAdapter;
97
+ AsyncAutoBindAdapter: typeof AsyncAutoBindAdapter;
98
+ CKEditor5Adapter: typeof CKEditor5Adapter;
99
+ CodeMirror6Adapter: typeof CodeMirror6Adapter;
100
+ ContentEditableAdapter: typeof ContentEditableAdapter;
101
+ AsyncContentEditableAdapter: typeof StateBasedContentEditableAdapter;
102
+ InputAdapter: typeof InputAdapter;
103
+ MultiEditorAdapter: typeof MultiEditorAdapter;
104
+ AsyncMultiEditorAdapter: typeof AsyncMultiEditorAdapter;
105
+ TinyMCEAdapter: typeof TinyMCEAdapter;
106
+ XeditorAdapter: typeof XeditorAdapter;
107
+ };
108
+ lookup: {
109
+ lookupMatches: typeof lookupMatches;
110
+ };
111
+ extractTextDomMapping: typeof extractTextDomMapping;
112
+ }
113
+
114
+ declare type AdapterConf = HasEditorID | HasElement;
115
+
116
+ export declare interface AdapterInterface extends CommonAdapterInterface {
117
+ selectRanges(checkId: string, matches: Match[]): void;
118
+ replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): void;
119
+ }
120
+
121
+ declare type AddSingleAdapterOptions = WrapperConfOptions;
122
+
123
+ declare interface AlignedMatch<T extends Match> {
124
+ originalMatch: T;
125
+ range: [number, number];
126
+ }
127
+
128
+ export declare interface AsyncAdapterInterface extends CommonAdapterInterface {
129
+ readonly isAsync: true;
130
+ readonly requiresSynchronization: boolean;
131
+ selectRanges(checkId: string, matches: Match[]): Promise<void>;
132
+ replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): Promise<void>;
133
+ }
134
+
135
+ export declare class AsyncAutoBindAdapter implements AsyncAdapterInterface {
136
+ private conf;
137
+ readonly isAsync: true;
138
+ readonly requiresSynchronization: true;
139
+ private asyncMultiAdapter;
140
+ constructor(conf: MultiEditorAdapterConfig & CommonAdapterConf & AutobindConfig);
141
+ private initMultiAdapter;
142
+ getFormat(): "HTML" | "AUTO";
143
+ extractContentForCheck(opts: ExtractContentForCheckOpts): Promise<ContentExtractionResult>;
144
+ registerCheckCall(_checkInfo: Check): void;
145
+ registerCheckResult(_checkResult: SuccessfulCheckResult): void;
146
+ selectRanges(checkId: string, matches: Match[]): Promise<void>;
147
+ replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): Promise<void>;
148
+ }
149
+
150
+ export declare class AsyncLocalStorage implements AsyncStorage {
151
+ get<T>(key: string): Promise<T | null>;
152
+ set<T>(key: string, value: T): Promise<undefined>;
153
+ }
154
+
155
+ export declare class AsyncMultiEditorAdapter extends MultiEditorAdapter implements AsyncAdapterInterface {
156
+ readonly isAsync: true;
157
+ readonly requiresSynchronization: true;
158
+ addSingleAdapter(singleAdapter: AsyncAdapterInterface | AdapterInterface, opts?: AddSingleAdapterOptions, id?: string): void;
159
+ selectRanges(checkId: string, matches: Match[]): Promise<void>;
160
+ replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): Promise<void>;
161
+ }
162
+
163
+ declare interface AsyncStorage {
164
+ get<T>(key: string): Promise<T | null>;
165
+ set<T>(key: string, value: T): Promise<void>;
166
+ }
167
+
168
+ declare type AttributeMap = {
169
+ [key: string]: any;
170
+ };
171
+
172
+ export declare class AutoBindAdapter implements AdapterInterface {
173
+ private conf;
174
+ private multiAdapter;
175
+ constructor(conf: MultiEditorAdapterConfig & CommonAdapterConf & AutobindConfig);
176
+ private initMultiAdapter;
177
+ getFormat(): "HTML" | "AUTO";
178
+ extractContentForCheck(opts: ExtractContentForCheckOpts): Promise<ContentExtractionResult>;
179
+ registerCheckCall(_checkInfo: Check): void;
180
+ registerCheckResult(_checkResult: SuccessfulCheckResult): void;
181
+ selectRanges(checkId: string, matches: Match[]): void;
182
+ replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): void;
183
+ }
184
+
185
+ declare interface AutobindConfig extends CommonAdapterConf {
186
+ enableQuipAdapter?: boolean;
187
+ }
188
+
189
+ export declare function autoBindFloatingSidebar(basicConf: AutoBindFloatingSidebarConfig): Promise<FloatingSidebar>;
190
+
191
+ export declare function autoBindFloatingSidebarAsync(basicConf: AutoBindFloatingSidebarConfig): Promise<FloatingSidebar>;
192
+
193
+ declare interface AutoBindFloatingSidebarConfig extends AcrolinxPluginConfig, MultiEditorAdapterConfig, AutobindConfig {
194
+ asyncStorage?: AsyncStorage;
195
+ }
196
+
197
+ declare interface AutobindWrapperAttributes {
198
+ 'original-id'?: string;
199
+ 'original-class'?: string;
200
+ 'original-name'?: string;
201
+ 'original-source': string;
202
+ 'original-display'?: string;
203
+ [key: string]: string | undefined;
204
+ }
205
+
206
+ declare interface CheckContentResult {
207
+ dom: HTMLElement;
208
+ text: string;
209
+ html: string;
210
+ }
211
+
212
+ declare interface CheckedRegisteredAdapter extends RegisteredAdapter {
213
+ checkedRange: [number, number];
214
+ }
215
+
216
+ export declare class CKEditor5Adapter extends AbstractRichtextEditorAdapter {
217
+ editorId: string;
218
+ constructor(conf: HasEditorID);
219
+ getEditor(): default_2;
220
+ getEditorDocument(): Document;
221
+ getContent(): string;
222
+ extractContentForCheck(): ContentExtractionResult;
223
+ selectRanges(checkId: string, matches: Match[]): void;
224
+ getEditorElement(): HTMLElement;
225
+ replaceRanges(checkId: string, matchesWithReplacementArg: MatchWithReplacement[]): void;
226
+ isInSourceEditingMode(): boolean;
227
+ }
228
+
229
+ export declare class CodeMirror6Adapter implements AdapterInterface {
230
+ private config;
231
+ private currentContentChecking?;
232
+ private lastContentChecked?;
233
+ private formatDetectedByCheck;
234
+ constructor(conf: CodeMirror6AdapterConf);
235
+ configure(partialConfig: Partial<CodeMirror6AdapterConf>): void;
236
+ private validateConf;
237
+ getContent(): string;
238
+ getFormat(): string;
239
+ extractContentForCheck(opts: ExtractContentForCheckOpts): ContentExtractionResult;
240
+ private getSelection;
241
+ registerCheckResult(checkResult: SuccessfulCheckResult): void;
242
+ registerCheckCall(_checkInfo: Check): void;
243
+ private lookupMatchesOrThrow;
244
+ selectRanges(_checkId: string, matches: Match[]): void;
245
+ replaceRanges(_checkId: string, matchesWithReplacement: MatchWithReplacement[]): void;
246
+ private getEscapeFunction;
247
+ private selectRange;
248
+ private selectRangeAndScroll;
249
+ private cmSelectionToRange;
250
+ }
251
+
252
+ declare type CodeMirror6AdapterConf = {
253
+ editor: EditorView;
254
+ format?: string;
255
+ };
256
+
257
+ declare interface CommonAdapterConf {
258
+ scrollOffsetY?: number;
259
+ disableInputEventSimulation?: boolean;
260
+ }
261
+
262
+ export declare interface CommonAdapterInterface {
263
+ getFormat?(): string;
264
+ getContent?(opts: ExtractContentForCheckOpts): string;
265
+ extractContentForCheck(opts: ExtractContentForCheckOpts): ContentExtractionResult | Promise<ContentExtractionResult>;
266
+ registerCheckCall(checkInfo: Check): void;
267
+ registerCheckResult(checkResult: SuccessfulCheckResult): void;
268
+ getAutobindWrapperAttributes?(): AutobindWrapperAttributes;
269
+ onInitFinished?(result: InitResult): void;
270
+ }
271
+
272
+ export declare class ContentEditableAdapter extends AbstractRichtextEditorAdapter {
273
+ element: HTMLElement;
274
+ constructor(conf: AdapterConf);
275
+ getEditorElement(): HTMLElement;
276
+ getContent(): string;
277
+ protected getSelection(): DocumentSelection;
278
+ getEditorDocument(): Document;
279
+ }
280
+
281
+ declare type ContentExtractionResult = SuccessfulContentExtractionResult | HasError;
282
+
283
+ /**
284
+ * Used inside of a sidebar iframe on a different domain.
285
+ */
286
+ export declare function createPluginMessageAdapter(win?: Window & typeof globalThis): AcrolinxPlugin_2;
287
+
288
+ declare interface DomPosition {
289
+ node: Node;
290
+ offset: number;
291
+ }
292
+
293
+ declare type ElementHtmlGetter = (el: HTMLElement) => string;
294
+
295
+ declare interface EscapeHtmlCharactersResult {
296
+ escapedText: string;
297
+ backwardAlignment: OffSetAlign[];
298
+ }
299
+
300
+ declare interface ExtractContentForCheckOpts {
301
+ checkSelection?: boolean;
302
+ }
303
+
304
+ export declare function extractTextDomMapping(node: Node): TextDomMapping;
305
+
306
+ declare interface FloatingSidebar {
307
+ toggleVisibility(): void;
308
+ remove(): void;
309
+ }
310
+
311
+ declare interface FloatingSidebarConfig {
312
+ asyncStorage: AsyncStorage;
313
+ sidebarContainerId?: string;
314
+ }
315
+
316
+ declare type Format = 'TEXT' | 'MARKDOWN';
317
+
318
+ export declare function getSelectionHtmlRanges(editorElement: HTMLElement, getElementHtml?: ElementHtmlGetter): [number, number][];
319
+
320
+ declare interface HasEditorID extends CommonAdapterConf {
321
+ editorId: string;
322
+ }
323
+
324
+ declare interface HasElement extends CommonAdapterConf {
325
+ element: HTMLElement;
326
+ }
327
+
328
+ declare interface HasError {
329
+ error: any;
330
+ }
331
+
332
+ export declare function initFloatingSidebar(config: FloatingSidebarConfig): FloatingSidebar;
333
+
334
+ export declare class InputAdapter implements AdapterInterface {
335
+ readonly element: ValidInputElement;
336
+ config: InputAdapterConf;
337
+ private currentContentChecking?;
338
+ private lastContentChecked?;
339
+ constructor(conf: InputAdapterConf);
340
+ getContent(): string;
341
+ getCurrentText(): string;
342
+ getFormat(): Format;
343
+ extractContentForCheck(opts: ExtractContentForCheckOpts): ContentExtractionResult;
344
+ private getSelection;
345
+ registerCheckResult(_checkResult: SuccessfulCheckResult): void;
346
+ registerCheckCall(_checkInfo: Check): void;
347
+ scrollAndSelect(matches: AlignedMatch<Match>[]): void;
348
+ selectRanges(checkId: string, matches: Match[]): void;
349
+ selectMatches<T extends Match>(_checkId: string, matches: T[]): AlignedMatch<T>[];
350
+ replaceAlignedMatches(matches: AlignedMatch<MatchWithReplacement>[]): void;
351
+ replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): void;
352
+ getAutobindWrapperAttributes(): AutobindWrapperAttributes;
353
+ }
354
+
355
+ declare type InputAdapterConf = AdapterConf & {
356
+ format?: Format;
357
+ };
358
+
359
+ declare type InputFormat = 'HTML' | 'TEXT';
360
+
361
+ /**
362
+ * Loads the Styles and Scripts of the sidebar into the current window.
363
+ * @param sidebarUrl must end with /
364
+ *
365
+ * TODO: Is this function currently used in any of our clients?
366
+ */
367
+ export declare function loadSidebarCode(sidebarBaseUrl: string): Promise<void>;
368
+
369
+ /**
370
+ * @param {string} checkedDocument Text or HTML of the document (at check time)
371
+ * @param {string} currentDocument Text or HTML of the current document
372
+ *
373
+ * @param {T[]} matches
374
+ *
375
+ * @param {InputFormat} inputFormat
376
+ * If checkedDocument is the HTML of the document (at check time)
377
+ * and currentDocument is the extracted text of the current document then
378
+ * you should set inputFormat to 'HTML'.
379
+ *
380
+ * @return {AlignedMatch<T extends Match>[]}
381
+ */
382
+ export declare function lookupMatches<T extends Match>(checkedDocument: string, currentDocument: string, matches: T[], inputFormat?: InputFormat): AlignedMatch<T>[];
383
+
384
+ export declare class MultiEditorAdapter implements AdapterInterface {
385
+ private config;
386
+ private rootElementWrapper?;
387
+ private adapters;
388
+ private adaptersOfLastSuccessfulCheck?;
389
+ constructor(config?: MultiEditorAdapterConfig);
390
+ getFormat(): "HTML" | "AUTO";
391
+ protected addSingleAdapterInternal(singleAdapter: AdapterInterface | AsyncAdapterInterface, opts?: AddSingleAdapterOptions, id?: string): void;
392
+ addSingleAdapter(singleAdapter: AdapterInterface, opts?: AddSingleAdapterOptions, id?: string): void;
393
+ removeAllAdapters(): void;
394
+ extractContentForCheck(opts: ExtractContentForCheckOpts): Promise<ContentExtractionResult>;
395
+ registerCheckCall(_checkInfo: Check): void;
396
+ registerCheckResult(checkResult: SuccessfulCheckResult): void;
397
+ selectRanges(checkId: string, matches: Match[]): void;
398
+ remapMatches<T extends Match>(matches: T[]): {
399
+ [id: string]: RemappedMatches<T>;
400
+ };
401
+ getAdapterForMatch(match: Match): CheckedRegisteredAdapter;
402
+ replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): void;
403
+ }
404
+
405
+ declare interface MultiEditorAdapterConfig {
406
+ aggregateFormat?: 'AUTO' | 'HTML';
407
+ documentHeader?: string;
408
+ rootElement?: WrapperConfOptions;
409
+ beforeCheck?: (multiAdapter: MultiEditorAdapter) => void;
410
+ }
411
+
412
+ declare interface OffSetAlign {
413
+ oldPosition: number;
414
+ diffOffset: number;
415
+ }
416
+
417
+ declare interface RegisteredAdapter {
418
+ id: string;
419
+ adapter: AdapterInterface | AsyncAdapterInterface;
420
+ wrapper: WrapperConf;
421
+ checkedRange?: [number, number];
422
+ escapeResult?: EscapeHtmlCharactersResult;
423
+ }
424
+
425
+ declare interface RemappedMatches<T extends Match> {
426
+ matches: T[];
427
+ adapter: AdapterInterface;
428
+ }
429
+
430
+ export declare class StateBasedContentEditableAdapter extends AbstractRichtextEditorAdapter implements AsyncAdapterInterface {
431
+ element: HTMLElement;
432
+ constructor(conf: AdapterConf);
433
+ readonly isAsync: true;
434
+ readonly requiresSynchronization: true;
435
+ getEditorElement(): HTMLElement;
436
+ getContent(): string;
437
+ protected getSelection(): DocumentSelection;
438
+ getEditorDocument(): Document;
439
+ selectRanges(checkId: string, matches: Match[]): Promise<void>;
440
+ replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): Promise<void>;
441
+ selectText(begin: number, length: number, textMapping: TextMapping_2): Promise<void>;
442
+ private addSelectionRange;
443
+ scrollIntoView(sel: Selection): Promise<void>;
444
+ }
445
+
446
+ declare interface SuccessfulCheckResult {
447
+ checkedPart: CheckedDocumentPart;
448
+ embedCheckInformation?: CheckInformationKeyValuePair[];
449
+ inputFormat?: string;
450
+ }
451
+
452
+ declare interface SuccessfulContentExtractionResult {
453
+ content: string;
454
+ documentReference?: string;
455
+ selection?: DocumentSelection;
456
+ externalContent?: ExternalContent;
457
+ }
458
+
459
+ declare interface TextDomMapping {
460
+ text: string;
461
+ domPositions: DomPosition[];
462
+ }
463
+
464
+ declare type TextMapping = TextDomMapping;
465
+
466
+ declare type TextMapping_2 = TextDomMapping;
467
+
468
+ export declare class TinyMCEAdapter extends AbstractRichtextEditorAdapter {
469
+ editorId: string;
470
+ constructor(conf: HasEditorID);
471
+ getEditor(): Editor;
472
+ getContent(opts: ExtractContentForCheckOpts): string;
473
+ getContentForCheckSelection: (el: HTMLElement) => string;
474
+ protected getSelection(): DocumentSelection;
475
+ getEditorDocument(): Document;
476
+ }
477
+
478
+ declare type ValidInputElement = HTMLInputElement | HTMLTextAreaElement;
479
+
480
+ declare interface WrapperConf extends WrapperConfOptions {
481
+ tagName: string;
482
+ attributes: AttributeMap;
483
+ }
484
+
485
+ declare interface WrapperConfOptions {
486
+ tagName?: string;
487
+ attributes?: AttributeMap;
488
+ }
489
+
490
+ export declare class XeditorAdapter implements AdapterInterface {
491
+ /**
492
+ * Editor of this adapter
493
+ *
494
+ * @property {any} editor
495
+ * Native Xeditor editor instance
496
+ */
497
+ protected editor: any;
498
+ /**
499
+ * Document of this adapter
500
+ *
501
+ * @property {any} editor
502
+ * Native Xeditor document instance
503
+ */
504
+ protected document: any;
505
+ /**
506
+ * SelectionManager of this adapter
507
+ *
508
+ * @property {any} editor
509
+ * Native Xeditor selection manager instance
510
+ */
511
+ protected selectionManager: any;
512
+ /**
513
+ * Content that is currently checking
514
+ *
515
+ * @property {string} currentContentChecking
516
+ * Content that is currently checking
517
+ */
518
+ protected currentContentChecking: string;
519
+ /**
520
+ * Content that was last checked
521
+ *
522
+ * @property {string} lastContentChecked
523
+ * Content that was last checked
524
+ */
525
+ protected lastContentChecked: string;
526
+ /**
527
+ * Creates a new instance of this acrolinx adapter
528
+ */
529
+ constructor(editor: any);
530
+ /**
531
+ * Implementation of getFormat of acrolinx.AdapterInterface
532
+ *
533
+ * @returns {string} Returns 'HTML'
534
+ */
535
+ getFormat(): string;
536
+ /**
537
+ * @inheritdoc
538
+ */
539
+ extractContentForCheck(_opts: ExtractContentForCheckOpts): ContentExtractionResult | Promise<ContentExtractionResult>;
540
+ /**
541
+ * @inheritdoc
542
+ */
543
+ registerCheckCall(_checkInfo: Check): void;
544
+ /**
545
+ * @inheritdoc
546
+ */
547
+ registerCheckResult(_checkResult: SuccessfulCheckResult): void;
548
+ /**
549
+ * @inheritdoc
550
+ */
551
+ replaceRanges(_checkId: string, matchesWithReplacement: MatchWithReplacement[]): void;
552
+ /**
553
+ * @inheritdoc
554
+ */
555
+ selectRanges(_checkId: string, matches: Match[]): void;
556
+ /**
557
+ * Replaces the aligned matches.
558
+ *
559
+ * @param {AlignedMatch<MatchWithReplacement>[]} matches
560
+ * Matches to replace
561
+ * @protected
562
+ */
563
+ replaceAlignedMatches(matches: AlignedMatch<MatchWithReplacement>[]): void;
564
+ /**
565
+ * Selects the given `matches` by aligning them and calling `selectAlignedMatches`.
566
+ *
567
+ * @param {Match[]} matches
568
+ * Matches to select
569
+ * @returns {AlignedMatch<T>[]} Aligned matches
570
+ * @protected
571
+ */
572
+ selectMatches<T extends Match>(matches: Match[]): AlignedMatch<T>[];
573
+ /**
574
+ * Selects the given `matches` using `selectText`.
575
+ *
576
+ * @param {AlignedMatch<Match>[]} matches
577
+ * Aligned matches to select
578
+ * @protected
579
+ */
580
+ selectAlignedMatches(matches: AlignedMatch<Match>[]): void;
581
+ /**
582
+ * Selects the range for the given offset.
583
+ *
584
+ * @param {number} begin
585
+ * Begin of the range
586
+ * @param {number} end
587
+ * End of the range
588
+ * @protected
589
+ */
590
+ selectText(begin: number, end: number): void;
591
+ /**
592
+ * Returns the prepared content for a check.
593
+ *
594
+ * @returns {CheckContentResult} Content to check
595
+ * @protected
596
+ */
597
+ getContentForCheck(): CheckContentResult;
598
+ /**
599
+ * Returns the specific element that should be used for the acrolinx check.
600
+ *
601
+ * @param {any} _element
602
+ * Element to get the acrolinx element from
603
+ * @param {any} role
604
+ * Role of the passed `_element`
605
+ * @param currentElement
606
+ * Element which is currently used
607
+ * @returns {HTMLElement} Element that should be used for acrolinx check
608
+ */
609
+ getAcrolinxElement(_element: any, role: any, currentElement: any): HTMLElement;
610
+ }
611
+
612
+ export { }