@umbraco-cms/backoffice 14.0.0--preview004-5857d7ce → 14.0.0--preview004-ada18684

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.
@@ -17,7 +17,7 @@ export let UmbCodeEditorModalElement = class UmbCodeEditorModalElement extends U
17
17
  this.#loadCodeEditor();
18
18
  }
19
19
  #handleConfirm() {
20
- this.modalContext?.submit({ content: this.data?.content ?? '' });
20
+ this.modalContext?.submit({ content: this._codeEditor?.editor?.monacoEditor?.getValue() ?? '' });
21
21
  }
22
22
  #handleCancel() {
23
23
  this.modalContext?.reject();
@@ -31,19 +31,10 @@ export let UmbCodeEditorModalElement = class UmbCodeEditorModalElement extends U
31
31
  console.error(error);
32
32
  }
33
33
  }
34
- // TODO => debounce?
35
- #onCodeEditorInput(e) {
36
- e.preventDefault();
37
- if (!this.data) {
38
- return;
39
- }
40
- this.data.content = this._codeEditor?.code ?? '';
41
- }
42
34
  #renderCodeEditor() {
43
35
  return html `<umb-code-editor
44
36
  language=${ifDefined(this.data?.language)}
45
- .code=${this.data?.content ?? ''}
46
- @input=${this.#onCodeEditorInput}></umb-code-editor>`;
37
+ .code=${this.data?.content ?? ''}></umb-code-editor>`;
47
38
  }
48
39
  #renderLoading() {
49
40
  return html `<div id="loader-container">
@@ -42,27 +42,25 @@ export default class UmbTinyMceLinkPickerPlugin extends UmbTinyMcePluginBase {
42
42
  data.text = ' ';
43
43
  }
44
44
  if (!this.#anchorElement) {
45
- this.#openLinkPicker();
45
+ this.#openLinkPicker({ name: this.editor.selection.getContent() });
46
46
  return;
47
47
  }
48
48
  //if we already have a link selected, we want to pass that data over to the dialog
49
49
  const currentTarget = {
50
- name: this.#anchorElement.title,
51
- url: this.#anchorElement.getAttribute('href') ?? '',
50
+ name: this.#anchorElement.title || this.#anchorElement.textContent,
52
51
  target: this.#anchorElement.target,
52
+ queryString: `${this.#anchorElement.search}${this.#anchorElement.hash}`,
53
53
  };
54
- // drop the lead char from the anchor text, if it has a value
55
- const anchorVal = this.#anchorElement.dataset.anchor;
56
- if (anchorVal) {
57
- currentTarget.queryString = anchorVal.substring(1);
54
+ if (this.#anchorElement.href.includes('localLink:')) {
55
+ const href = this.#anchorElement.getAttribute('href');
56
+ currentTarget.udi = href.split('localLink:')[1].slice(0, -1);
58
57
  }
59
- if (currentTarget.url?.includes('localLink:')) {
60
- currentTarget.udi =
61
- currentTarget.url?.substring(currentTarget.url.indexOf(':') + 1, currentTarget.url.lastIndexOf('}')) ?? '';
58
+ else if (this.#anchorElement.host.length) {
59
+ currentTarget.url = this.#anchorElement.protocol ? this.#anchorElement.protocol + '//' : undefined;
60
+ currentTarget.url += this.#anchorElement.host + this.#anchorElement.pathname;
62
61
  }
63
62
  this.#openLinkPicker(currentTarget);
64
63
  }
65
- // TODO => get anchors to provide to link picker?
66
64
  async #openLinkPicker(currentTarget) {
67
65
  const modalHandler = this.#modalContext?.open(UMB_LINK_PICKER_MODAL, {
68
66
  config: {
@@ -73,7 +71,7 @@ export default class UmbTinyMceLinkPickerPlugin extends UmbTinyMcePluginBase {
73
71
  });
74
72
  if (!modalHandler)
75
73
  return;
76
- const linkPickerData = await modalHandler.onSubmit();
74
+ const linkPickerData = await modalHandler.onSubmit().catch(() => undefined);
77
75
  if (!linkPickerData)
78
76
  return;
79
77
  this.#linkPickerData = linkPickerData;
@@ -82,12 +80,17 @@ export default class UmbTinyMceLinkPickerPlugin extends UmbTinyMcePluginBase {
82
80
  //Create a json obj used to create the attributes for the tag
83
81
  // TODO => where has rel gone?
84
82
  #createElemAttributes() {
85
- const a = Object.assign({}, this.#linkPickerData?.link, { 'data-anchor': null });
83
+ // Attribute 'name' because of linkPickerData. It should be 'title' .
84
+ const { name, ...linkPickerData } = this.#linkPickerData.link;
85
+ const a = Object.assign({}, linkPickerData);
86
86
  // always need to map back to href for tinymce to render correctly
87
87
  // do this first as checking querystring below may modify the href property
88
88
  if (this.#linkPickerData?.link.url) {
89
89
  a.href = this.#linkPickerData.link.url;
90
90
  }
91
+ if (this.#linkPickerData?.link.name) {
92
+ a.title = name;
93
+ }
91
94
  if (this.#linkPickerData?.link.queryString?.startsWith('#')) {
92
95
  a['data-anchor'] = this.#linkPickerData?.link.queryString;
93
96
  a.href += this.#linkPickerData?.link.queryString;
@@ -136,7 +139,7 @@ export default class UmbTinyMceLinkPickerPlugin extends UmbTinyMcePluginBase {
136
139
  this.#linkPickerData.link.queryString = urlParts[1] + urlParts[2];
137
140
  }
138
141
  }
139
- if (!this.#linkPickerData?.link.url && !this.#linkPickerData?.link.queryString) {
142
+ if (!this.#linkPickerData?.link.url && !this.#linkPickerData?.link.queryString && !this.#linkPickerData?.link.udi) {
140
143
  this.editor.execCommand('unlink');
141
144
  return;
142
145
  }
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { UmbTextStyles } from "../../../../../shared/style/index.js";
7
+ import { UmbTextStyles } from '../../../../../shared/style/index.js';
8
8
  import { html, customElement, property } from '../../../../../external/lit/index.js';
9
9
  import { UmbLitElement } from '../../../../../shared/lit-element/index.js';
10
10
  /**