umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.48k stars 2.69k forks source link

Not possible to extend on top of built-in editors via LIT #17264

Open bielu opened 2 weeks ago

bielu commented 2 weeks ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

14 and 15

Bug summary

I tried to built custom editors which extend on built-in ones, but it fails, because types are not exported, so the extending is impossible. Example code:

import { html, customElement, property } from "@umbraco-cms/backoffice/external/lit";
// @ts-ignore
import {UmbPropertyEditorUiElement} from "@umbraco-cms/backoffice/dist-cms/packages/core/extension-registry";
import UmbPropertyEditorUINumberElement
  from "@umbraco-cms/backoffice/dist-cms/packages/property-editors/number/property-editor-ui-number.element";

/**
 * An example element.
 *
 * @slot - This element has a slot
 * @csspart button - The button
 */
@customElement('test-element')
export class Test extends UmbPropertyEditorUINumberElement implements UmbPropertyEditorUiElement{
  @property({ type: String })
  public value = "";

  render() {
    return html`I'm a property editor!  3 3`;
  }
}

Specifics

No response

Steps to reproduce

  1. build new library package
  2. install backoffice
  3. try to compile example above

Expected result / actual result

I would expect to be able to extend on top of elements built-in in umbraco backoffice (especially property editors).

github-actions[bot] commented 2 weeks ago

Hi there @bielu!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

jmvivas commented 2 weeks ago

Same here: trying to follow this tutorial on U14.3 https://docs.umbraco.com/umbraco-cms/tutorials/creating-a-property-editor and this line import { UmbPropertyEditorUiElement } from "@umbraco-cms/backoffice/extension-registry"; throws this error: error TS2305: Module '"@umbraco-cms/backoffice/extension-registry"' has no exported member 'UmbPropertyEditorUiElement'

jcdcdev commented 1 week ago

This also happens to me on jcdcdev.Umbraco.ExtendedMarkdownEditor

I updated @umbraco-cms/backoffice from 14.0.0 to 15.0.0-rc2

Failed Build

Error: src/editor/extended-dropdown-editor.ts(6,9): error TS2305: Module '"@umbraco-cms/backoffice/extension-registry"' has no exported member 'UmbPropertyEditorUiElement'.
Error: src/editor/manifests.ts(1,9): error TS2305: Module '"@umbraco-cms/backoffice/extension-registry"' has no exported member 'ManifestPropertyEditorUi'.
Error: src/lang/manifests.ts(1,9): error TS2305: Module '"@umbraco-cms/backoffice/extension-registry"' has no exported member 'ManifestLocalization'.
Error: Process completed with exit code 2.
jcdcdev commented 1 week ago

Hi @bielu & @jmvivas , I believe this fix is to import UmbPropertyEditorUiElement from @umbraco-cms/backoffice/property-editor instead of @umbraco-cms/backoffice/extension-registry or @umbraco-cms/backoffice/dist-cms/packages/core/extension-registry

bielu commented 1 week ago

@jcdcdev this issue is about not being able extend on UmbPropertyEditorUiElement, but Umbraco editors such as UmbPropertyEditorUINumberElement.

jmvivas commented 1 week ago

@jcdcdev your suggestion works perfectly for the Umbraco Suggestions property editor tutorial but that just extends UmbElementMixin. I'll try with Umb editors to see what I get