chore(sonarcloud): fix issues
This commit is contained in:
@@ -64,7 +64,7 @@ export class UmbInputTinyMceElement extends UUIFormControlMixin(UmbLitElement, '
|
||||
|
||||
override set value(newValue: FormDataEntryValue | FormData) {
|
||||
super.value = newValue;
|
||||
const newContent = newValue?.toString() ?? '';
|
||||
const newContent = typeof newValue === 'string' ? newValue : '';
|
||||
|
||||
if (this.#editorRef && this.#editorRef.getContent() != newContent) {
|
||||
this.#editorRef.setContent(newContent);
|
||||
@@ -362,7 +362,7 @@ export class UmbInputTinyMceElement extends UUIFormControlMixin(UmbLitElement, '
|
||||
//enable browser based spell checking
|
||||
editor.getBody().setAttribute('spellcheck', 'true');
|
||||
uriAttributeSanitizer(editor);
|
||||
editor.setContent(this.value?.toString() ?? '');
|
||||
editor.setContent(typeof this.value === 'string' ? this.value : '');
|
||||
}
|
||||
|
||||
#onChange(value: string) {
|
||||
|
||||
@@ -27,13 +27,7 @@ export const uriAttributeSanitizer = (editor: Editor) => {
|
||||
|
||||
return function parseUri(uri: string, tagName: string) {
|
||||
uri = uri.replace(trimRegExp, '');
|
||||
try {
|
||||
// Might throw malformed URI sequence
|
||||
uri = decodeURIComponent(uri);
|
||||
} catch (ex) {
|
||||
// Fallback to non UTF-8 decoder
|
||||
uri = unescape(uri);
|
||||
}
|
||||
uri = decodeURIComponent(uri);
|
||||
|
||||
if (scriptUriRegExp.test(uri)) {
|
||||
return;
|
||||
|
||||
@@ -10,11 +10,11 @@ import '../../components/input-tiny-mce/input-tiny-mce.element.js';
|
||||
@customElement('umb-property-editor-ui-tiny-mce')
|
||||
export class UmbPropertyEditorUITinyMceElement extends UmbRteBaseElement {
|
||||
#onChange(event: CustomEvent & { target: UmbInputTinyMceElement }) {
|
||||
const value = event.target.value;
|
||||
const value = typeof event.target.value === 'string' ? event.target.value : '';
|
||||
|
||||
// Clone the DOM, to remove the classes and attributes on the original:
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = value.toString();
|
||||
div.innerHTML = value;
|
||||
|
||||
// Loop through used, to remove the classes on these.
|
||||
const blockEls = div.querySelectorAll(`umb-rte-block, umb-rte-block-inline`);
|
||||
|
||||
@@ -53,7 +53,7 @@ export default class UmbTiptapLinkExtensionApi extends UmbTiptapToolbarElementAp
|
||||
let { queryString, url } = link;
|
||||
|
||||
// If an anchor exists, check that it is appropriately prefixed
|
||||
if (queryString && !queryString?.startsWith('?') && !queryString?.startsWith('#')) {
|
||||
if (!queryString?.startsWith('?') && !queryString?.startsWith('#')) {
|
||||
queryString = (queryString?.startsWith('=') ? '#' : '?') + queryString;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user