@umbraco-cms/backoffice 14.3.0 → 14.3.1

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 (55) hide show
  1. package/dist-cms/assets/lang/bs.js +2 -2
  2. package/dist-cms/assets/lang/bs.ts +2 -2
  3. package/dist-cms/assets/lang/cs-cz.js +2 -2
  4. package/dist-cms/assets/lang/cs-cz.ts +2 -2
  5. package/dist-cms/assets/lang/cy-gb.js +2 -2
  6. package/dist-cms/assets/lang/cy-gb.ts +2 -2
  7. package/dist-cms/assets/lang/da-dk.js +2 -2
  8. package/dist-cms/assets/lang/da-dk.ts +2 -2
  9. package/dist-cms/assets/lang/de-de.js +2 -2
  10. package/dist-cms/assets/lang/de-de.ts +2 -2
  11. package/dist-cms/assets/lang/en-us.js +2 -2
  12. package/dist-cms/assets/lang/en-us.ts +2 -2
  13. package/dist-cms/assets/lang/en.js +2 -2
  14. package/dist-cms/assets/lang/en.ts +2 -2
  15. package/dist-cms/assets/lang/es-es.js +3 -3
  16. package/dist-cms/assets/lang/es-es.ts +3 -3
  17. package/dist-cms/assets/lang/fr-fr.js +2 -2
  18. package/dist-cms/assets/lang/fr-fr.ts +2 -3
  19. package/dist-cms/assets/lang/he-il.js +1 -1
  20. package/dist-cms/assets/lang/he-il.ts +1 -1
  21. package/dist-cms/assets/lang/hr-hr.js +2 -2
  22. package/dist-cms/assets/lang/hr-hr.ts +2 -2
  23. package/dist-cms/assets/lang/it-it.js +1 -1
  24. package/dist-cms/assets/lang/it-it.ts +1 -1
  25. package/dist-cms/assets/lang/ja-jp.js +1 -1
  26. package/dist-cms/assets/lang/ja-jp.ts +1 -1
  27. package/dist-cms/assets/lang/ko-kr.js +1 -1
  28. package/dist-cms/assets/lang/ko-kr.ts +1 -1
  29. package/dist-cms/assets/lang/nb-no.js +3 -1
  30. package/dist-cms/assets/lang/nb-no.ts +3 -1
  31. package/dist-cms/assets/lang/nl-nl.js +2 -2
  32. package/dist-cms/assets/lang/nl-nl.ts +2 -2
  33. package/dist-cms/assets/lang/pl-pl.js +2 -2
  34. package/dist-cms/assets/lang/pl-pl.ts +2 -2
  35. package/dist-cms/assets/lang/pt-br.js +1 -1
  36. package/dist-cms/assets/lang/pt-br.ts +1 -1
  37. package/dist-cms/assets/lang/ru-ru.js +2 -2
  38. package/dist-cms/assets/lang/ru-ru.ts +2 -2
  39. package/dist-cms/assets/lang/tr-tr.js +2 -2
  40. package/dist-cms/assets/lang/tr-tr.ts +2 -2
  41. package/dist-cms/assets/lang/uk-ua.js +2 -2
  42. package/dist-cms/assets/lang/uk-ua.ts +2 -2
  43. package/dist-cms/assets/lang/zh-cn.js +2 -2
  44. package/dist-cms/assets/lang/zh-cn.ts +2 -2
  45. package/dist-cms/assets/lang/zh-tw.js +1 -1
  46. package/dist-cms/assets/lang/zh-tw.ts +1 -2
  47. package/dist-cms/packages/core/utils/index.d.ts +1 -0
  48. package/dist-cms/packages/core/utils/index.js +1 -0
  49. package/dist-cms/packages/core/utils/sanitize/sanitize-html.function.d.ts +6 -0
  50. package/dist-cms/packages/core/utils/sanitize/sanitize-html.function.js +9 -0
  51. package/dist-cms/packages/dictionary/workspace/views/workspace-view-dictionary-editor.element.js +9 -5
  52. package/dist-cms/packages/markdown-editor/components/input-markdown-editor/input-markdown.element.js +2 -2
  53. package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
  54. package/dist-cms/umbraco-package.json +1 -1
  55. package/package.json +1 -1
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Sanitize a HTML string by removing any potentially harmful content such as scripts.
3
+ * @param {string} html The HTML string to sanitize.
4
+ * @returns The sanitized HTML string.
5
+ */
6
+ export declare function sanitizeHTML(html: string): string;
@@ -0,0 +1,9 @@
1
+ import { DOMPurify } from '../../../../external/dompurify/index.js';
2
+ /**
3
+ * Sanitize a HTML string by removing any potentially harmful content such as scripts.
4
+ * @param {string} html The HTML string to sanitize.
5
+ * @returns The sanitized HTML string.
6
+ */
7
+ export function sanitizeHTML(html) {
8
+ return DOMPurify.sanitize(html);
9
+ }
@@ -6,11 +6,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { UMB_DICTIONARY_WORKSPACE_CONTEXT } from '../dictionary-workspace.context-token.js';
8
8
  import { UUITextareaEvent } from '../../../../external/uui/index.js';
9
- import { css, html, customElement, state, repeat, ifDefined, unsafeHTML } from '../../../../external/lit/index.js';
9
+ import { css, html, customElement, state, repeat } from '../../../../external/lit/index.js';
10
10
  import { UmbLitElement } from '../../../core/lit-element/index.js';
11
11
  import { UmbLanguageCollectionRepository } from '../../../language/index.js';
12
12
  import { UMB_CURRENT_USER_CONTEXT } from '../../../user/current-user/index.js';
13
+ import { sanitizeHTML } from '../../../core/utils/index.js';
13
14
  let UmbWorkspaceViewDictionaryEditorElement = class UmbWorkspaceViewDictionaryEditorElement extends UmbLitElement {
15
+ get #dictionaryName() {
16
+ return typeof this._dictionary?.name !== 'undefined' ? sanitizeHTML(this._dictionary.name) : '...';
17
+ }
14
18
  #languageCollectionRepository;
15
19
  #workspaceContext;
16
20
  #currentUserContext;
@@ -46,7 +50,7 @@ let UmbWorkspaceViewDictionaryEditorElement = class UmbWorkspaceViewDictionaryEd
46
50
  }
47
51
  }
48
52
  #observeDictionary() {
49
- this.observe(this.#workspaceContext.dictionary, (dictionary) => {
53
+ this.observe(this.#workspaceContext?.dictionary, (dictionary) => {
50
54
  this._dictionary = dictionary;
51
55
  });
52
56
  }
@@ -64,13 +68,13 @@ let UmbWorkspaceViewDictionaryEditorElement = class UmbWorkspaceViewDictionaryEd
64
68
  const target = e.composedPath()[0];
65
69
  const translation = target.value.toString();
66
70
  const isoCode = target.getAttribute('name');
67
- this.#workspaceContext.setPropertyValue(isoCode, translation);
71
+ this.#workspaceContext?.setPropertyValue(isoCode, translation);
68
72
  }
69
73
  }
70
74
  render() {
71
75
  return html `
72
76
  <uui-box>
73
- ${unsafeHTML(this.localize.term('dictionaryItem_description', this._dictionary?.name || '&#8203;'))}
77
+ ${this.localize.term('dictionaryItem_description', this.#dictionaryName)}
74
78
  ${repeat(this._languages, (item) => item.unique, (item) => this.#renderTranslation(item))}
75
79
  </uui-box>
76
80
  `;
@@ -85,7 +89,7 @@ let UmbWorkspaceViewDictionaryEditorElement = class UmbWorkspaceViewDictionaryEd
85
89
  name=${language.unique}
86
90
  label="translation"
87
91
  @change=${this.#onTextareaChange}
88
- value=${ifDefined(translation?.translation)}
92
+ .value=${translation?.translation ?? ''}
89
93
  ?readonly=${this.#isReadOnly(language.unique)}></uui-textarea>
90
94
  </umb-property-layout>`;
91
95
  }
@@ -9,7 +9,6 @@ import { createExtensionApi } from '../../../../libs/extension-api/index.js';
9
9
  import { marked } from '../../../../external/marked/index.js';
10
10
  import { monaco } from '../../../../external/monaco-editor/index.js';
11
11
  import { umbExtensionsRegistry } from '../../../core/extension-registry/index.js';
12
- import { DOMPurify } from '../../../../external/dompurify/index.js';
13
12
  import { UmbChangeEvent } from '../../../core/event/index.js';
14
13
  import { UmbLitElement } from '../../../core/lit-element/index.js';
15
14
  import { UmbTextStyles } from '../../../core/style/index.js';
@@ -17,6 +16,7 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '../../../core/modal/index.js';
17
16
  import { UMB_MEDIA_PICKER_MODAL, UmbMediaUrlRepository } from '../../../media/media/index.js';
18
17
  import { UmbCodeEditorLoadedEvent } from '../../../code-editor/index.js';
19
18
  import { UmbFormControlMixin } from '../../../core/validation/index.js';
19
+ import { sanitizeHTML } from '../../../core/utils/index.js';
20
20
  const elementName = 'umb-input-markdown';
21
21
  /**
22
22
  * @element umb-input-markdown
@@ -519,7 +519,7 @@ let UmbInputMarkdownElement = class UmbInputMarkdownElement extends UmbFormContr
519
519
  if (!this.preview || !this.value)
520
520
  return;
521
521
  const markdownAsHtml = marked.parse(this.value);
522
- const sanitizedHtml = markdownAsHtml ? DOMPurify.sanitize(markdownAsHtml) : '';
522
+ const sanitizedHtml = markdownAsHtml ? sanitizeHTML(markdownAsHtml) : '';
523
523
  return html `<uui-scroll-container id="preview">${unsafeHTML(sanitizedHtml)}</uui-scroll-container>`;
524
524
  }
525
525
  static { this.styles = [