diff --git a/src/Umbraco.Web.UI.Client/.eslintignore b/src/Umbraco.Web.UI.Client/.eslintignore index 94e46647ec..8c686499db 100644 --- a/src/Umbraco.Web.UI.Client/.eslintignore +++ b/src/Umbraco.Web.UI.Client/.eslintignore @@ -2,4 +2,5 @@ types dist schemas -temp-schema-generator \ No newline at end of file +temp-schema-generator +APP_PLUGINS \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/APP_PLUGINS/property-editor.js b/src/Umbraco.Web.UI.Client/APP_PLUGINS/property-editor.js new file mode 100644 index 0000000000..a79a2b9b72 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/APP_PLUGINS/property-editor.js @@ -0,0 +1,13 @@ +const template = document.createElement('template'); +template.innerHTML = ` + Example of a vanilla JS Property Editor +`; + +export default class MyPropertyEditorUI extends HTMLElement { + constructor() { + super(); + this.attachShadow({mode: 'open'}); + this.shadowRoot.appendChild(template.content.cloneNode(true)); + } +} +customElements.define('my-property-editor-ui-custom', MyPropertyEditorUI); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/APP_PLUGINS/readme.md b/src/Umbraco.Web.UI.Client/APP_PLUGINS/readme.md new file mode 100644 index 0000000000..c273f4fdac --- /dev/null +++ b/src/Umbraco.Web.UI.Client/APP_PLUGINS/readme.md @@ -0,0 +1 @@ +// TODO: write description diff --git a/src/Umbraco.Web.UI.Client/APP_PLUGINS/section.js b/src/Umbraco.Web.UI.Client/APP_PLUGINS/section.js new file mode 100644 index 0000000000..c55d9eb25b --- /dev/null +++ b/src/Umbraco.Web.UI.Client/APP_PLUGINS/section.js @@ -0,0 +1,25 @@ +const template = document.createElement('template'); +template.innerHTML = ` + + + +

Custom Section

+

Example of vanilla JS section

+
+`; + +export default class MySectionCustom extends HTMLElement { + constructor() { + super(); + this.attachShadow({mode: 'open'}); + this.shadowRoot.appendChild(template.content.cloneNode(true)); + } +} + +customElements.define('my-section-custom', MySectionCustom); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/property-editors/external-property-editor-test.js b/src/Umbraco.Web.UI.Client/src/backoffice/property-editors/external-property-editor-test.js deleted file mode 100644 index b6c1a51c2e..0000000000 --- a/src/Umbraco.Web.UI.Client/src/backoffice/property-editors/external-property-editor-test.js +++ /dev/null @@ -1,11 +0,0 @@ -export default class ExternalPropertyEditorTest extends HTMLElement { - - constructor() { - super(); - this.attachShadow({mode: 'open'}); // sets and returns 'this.shadowRoot' - const wrapper = document.createElement('span'); - wrapper.textContent = 'Example of a pure JS Property Editor'; - this.shadowRoot.append(wrapper); - } -} -customElements.define('external-property-editor-test', ExternalPropertyEditorTest); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/core/stores/data-type.store.ts b/src/Umbraco.Web.UI.Client/src/core/stores/data-type.store.ts index 0c628ebd5d..23629f0efa 100644 --- a/src/Umbraco.Web.UI.Client/src/core/stores/data-type.store.ts +++ b/src/Umbraco.Web.UI.Client/src/core/stores/data-type.store.ts @@ -22,8 +22,8 @@ export class UmbDataTypeStore { { id: 1246, key: 'dt-3', - name: 'External Test (DataType)', - propertyEditorUIAlias: 'External.PropertyEditorUI.Test', + name: 'My JS Property Editor (DataType)', + propertyEditorUIAlias: 'My.PropertyEditorUI.Custom', }, { id: 1247, diff --git a/src/Umbraco.Web.UI.Client/src/index.ts b/src/Umbraco.Web.UI.Client/src/index.ts index 23a84fb0d1..747f6a2429 100644 --- a/src/Umbraco.Web.UI.Client/src/index.ts +++ b/src/Umbraco.Web.UI.Client/src/index.ts @@ -95,17 +95,6 @@ const registerInternalManifests = async () => { group: 'common', }, }, - { - type: 'propertyEditorUI', - alias: 'External.PropertyEditorUI.Test', - name: 'Text', - //elementName: 'external-property-editor-test', //Gets the element name from JS file. - js: '/src/backoffice/property-editors/external-property-editor-test.js', - meta: { - icon: 'document', - group: 'common', - }, - }, /* { type: 'propertyEditorUI', diff --git a/src/Umbraco.Web.UI.Client/src/mocks/data/content.data.ts b/src/Umbraco.Web.UI.Client/src/mocks/data/content.data.ts index d41097a685..973c13f9ab 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/data/content.data.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/data/content.data.ts @@ -104,7 +104,7 @@ export const data: Array = [ }, { alias: 'myExternalEditor', - label: 'External label', + label: 'My JS Property Editor', description: 'This is the a external property', dataTypeKey: 'dt-3', tempValue: 'Tex lkasdfkljdfsa 1', diff --git a/src/Umbraco.Web.UI.Client/src/mocks/domains/manifests.handlers.ts b/src/Umbraco.Web.UI.Client/src/mocks/domains/manifests.handlers.ts index 8429f4701e..ad864220ff 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/domains/manifests.handlers.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/domains/manifests.handlers.ts @@ -11,13 +11,23 @@ export const handlers = [ { type: 'section', alias: 'My.Section.Custom', - name: 'Custom', - elementName: 'umb-custom-section', + name: 'Custom Section', + js: '/APP_PLUGINS/section.js', meta: { pathname: 'my-custom', weight: 1, }, }, + { + type: 'propertyEditorUI', + alias: 'My.PropertyEditorUI.Custom', + name: 'My Custom Property Editor UI', + js: '/APP_PLUGINS/property-editor.js', + meta: { + icon: 'document', + group: 'common', + }, + }, ], }) );