@acrolinx/sidebar-sdk 1.1.14 → 2.0.0

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