MOBILE-3947 chore: Deprecation fixes

main
Pau Ferrer Ocaña 2023-11-07 16:16:51 +01:00
parent a81f93822f
commit 4ca0cf785a
3 changed files with 14 additions and 7 deletions

View File

@ -174,6 +174,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit,
this.lastDraft = this.control?.value;
// Use paragraph on enter.
// eslint-disable-next-line deprecation/deprecation
document.execCommand('DefaultParagraphSeparator', false, 'p');
this.maximizeEditorSize();
@ -632,6 +633,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit,
*/
protected executeCommand({ name: command, parameters }: EditorCommand): void {
if (parameters == 'block') {
// eslint-disable-next-line deprecation/deprecation
document.execCommand('formatBlock', false, '<' + command + '>');
return;
@ -641,6 +643,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit,
this.toolbarStyles[parameters] = this.toolbarStyles[parameters] == 'true' ? 'false' : 'true';
}
// eslint-disable-next-line deprecation/deprecation
document.execCommand(command, false);
// Modern browsers are using non a11y tags, so replace them.
@ -1043,6 +1046,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit,
if (text) {
this.editorElement?.focus(); // Make sure the editor is focused.
// eslint-disable-next-line deprecation/deprecation
document.execCommand('insertText', false, text);
}
}

View File

@ -349,12 +349,15 @@ export class CoreLangProvider {
getTranslationTable(lang: string): Promise<Record<string, unknown>> {
// Create a promise to convert the observable into a promise.
return new Promise((resolve, reject): void => {
const observer = Translate.getTranslation(lang).subscribe((table) => {
resolve(table);
observer.unsubscribe();
}, (err) => {
reject(err);
observer.unsubscribe();
const observer = Translate.getTranslation(lang).subscribe({
next: (table) => {
resolve(table);
observer.unsubscribe();
},
error: (err) => {
reject(err);
observer.unsubscribe();
},
});
});
}

View File

@ -376,7 +376,7 @@ export class CoreUtilsProvider {
virtualInput.innerHTML = text;
virtualInput.select();
virtualInput.setSelectionRange(0, 99999);
document.execCommand('copy');
document.execCommand('copy'); // eslint-disable-line deprecation/deprecation
}
// Show toast using ionicLoading.