Skip to content

Commit 4b7bb09

Browse files
committed
Merge branch 'main' into v14/chore/bundling-umbraco-news
2 parents b0bd3aa + 6366776 commit 4b7bb09

File tree

28 files changed

+171
-101
lines changed

28 files changed

+171
-101
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"./repository": "./dist-cms/packages/core/repository/index.js",
7171
"./resources": "./dist-cms/packages/core/resources/index.js",
7272
"./router": "./dist-cms/packages/core/router/index.js",
73+
"./script": "./dist-cms/packages/templating/scripts/index.js",
7374
"./search": "./dist-cms/packages/search/index.js",
7475
"./section": "./dist-cms/packages/core/section/index.js",
7576
"./settings": "./dist-cms/packages/settings/index.js",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export default class UmbTinyMceMockPlugin {
2+
/**
3+
* @param {TinyMcePluginArguments} args
4+
*/
5+
constructor(args) {
6+
// Add your plugin code here
7+
console.log('editor initialized', args)
8+
}
9+
}

src/mocks/handlers/manifests.handlers.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ const privateManifests: PackageManifestResponse = [
4545
propertyEditorSchema: 'Umbraco.TextBox',
4646
},
4747
},
48+
{
49+
type: 'tinyMcePlugin',
50+
alias: 'My.TinyMcePlugin.Custom',
51+
name: 'My Custom TinyMce Plugin',
52+
js: '/App_Plugins/tinyMcePlugin.js',
53+
meta: {
54+
config: {
55+
plugins: ['wordcount'],
56+
statusbar: true,
57+
},
58+
},
59+
},
4860
],
4961
},
5062
{

src/packages/core/components/entity-actions-bundle/entity-actions-bundle.element.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export class UmbEntityActionsBundleElement extends UmbLitElement {
8585

8686
async #onFirstActionClick(event: PointerEvent) {
8787
event.stopPropagation();
88+
this.#sectionSidebarContext?.closeContextMenu();
8889
await this._firstActionApi?.execute();
8990
}
9091

src/packages/core/extension-registry/models/tinymce-plugin.model.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { UmbTinyMcePluginBase } from '@umbraco-cms/backoffice/tiny-mce';
22
import type { ManifestApi } from '@umbraco-cms/backoffice/extension-api';
3+
import type { RawEditorOptions } from '@umbraco-cms/backoffice/external/tinymce';
34

45
export interface MetaTinyMcePlugin {
56
/**
@@ -26,6 +27,20 @@ export interface MetaTinyMcePlugin {
2627
*/
2728
icon?: string;
2829
}>;
30+
31+
/**
32+
* Sets the default configuration for the TinyMCE editor. This configuration will be used when the editor is initialized.
33+
*
34+
* @see [TinyMCE Configuration](https://www.tiny.cloud/docs/configure/) for more information.
35+
* @optional
36+
* @examples [
37+
* {
38+
* "plugins": "wordcount",
39+
* "statusbar": true
40+
* }
41+
* ]
42+
*/
43+
config?: RawEditorOptions;
2944
}
3045

3146
/**

src/packages/core/menu/menu-tree-structure-workspace-context-base.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,31 @@ export abstract class UmbMenuTreeStructureWorkspaceContextBase extends UmbContex
5858
}
5959

6060
const isNew = this.#workspaceContext?.getIsNew();
61-
const uniqueObservable = isNew ? this.#workspaceContext?.parentUnique : this.#workspaceContext?.unique;
62-
const entityTypeObservable = isNew ? this.#workspaceContext?.parentEntityType : this.#workspaceContext?.entityType;
63-
64-
const unique = (await this.observe(uniqueObservable, () => {})?.asPromise()) as string;
65-
if (!unique) throw new Error('Unique is not available');
6661

62+
const entityTypeObservable = isNew ? this.#workspaceContext?.parentEntityType : this.#workspaceContext?.entityType;
6763
const entityType = (await this.observe(entityTypeObservable, () => {})?.asPromise()) as string;
6864
if (!entityType) throw new Error('Entity type is not available');
6965

70-
const { data } = await treeRepository.requestTreeItemAncestors({ treeItem: { unique, entityType } });
71-
72-
if (data) {
73-
const ancestorItems = data.map((treeItem) => {
74-
return {
75-
unique: treeItem.unique,
76-
entityType: treeItem.entityType,
77-
name: treeItem.name,
78-
isFolder: treeItem.isFolder,
79-
};
80-
});
81-
82-
structureItems.push(...ancestorItems);
66+
// If the entity type is different from the root entity type, then we can request the ancestors.
67+
if (entityType !== root?.entityType) {
68+
const uniqueObservable = isNew ? this.#workspaceContext?.parentUnique : this.#workspaceContext?.unique;
69+
const unique = (await this.observe(uniqueObservable, () => {})?.asPromise()) as string;
70+
if (!unique) throw new Error('Unique is not available');
71+
72+
const { data } = await treeRepository.requestTreeItemAncestors({ treeItem: { unique, entityType } });
73+
74+
if (data) {
75+
const ancestorItems = data.map((treeItem) => {
76+
return {
77+
unique: treeItem.unique,
78+
entityType: treeItem.entityType,
79+
name: treeItem.name,
80+
isFolder: treeItem.isFolder,
81+
};
82+
});
83+
84+
structureItems.push(...ancestorItems);
85+
}
8386
}
8487

8588
const parent = structureItems[structureItems.length - 2];

src/packages/media/media/collection/media-collection.element.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
import { UMB_MEDIA_ENTITY_TYPE, UMB_MEDIA_ROOT_ENTITY_TYPE } from '../entity.js';
2+
import { UMB_MEDIA_WORKSPACE_CONTEXT } from '../workspace/media-workspace.context-token.js';
13
import type { UmbMediaCollectionContext } from './media-collection.context.js';
24
import { UMB_MEDIA_COLLECTION_CONTEXT } from './media-collection.context-token.js';
35
import { customElement, html, state, when } from '@umbraco-cms/backoffice/external/lit';
46
import { UmbCollectionDefaultElement } from '@umbraco-cms/backoffice/collection';
57
import type { UmbProgressEvent } from '@umbraco-cms/backoffice/event';
68

79
import './media-collection-toolbar.element.js';
10+
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
11+
import { UmbRequestReloadChildrenOfEntityEvent } from '@umbraco-cms/backoffice/entity-action';
812

913
@customElement('umb-media-collection')
1014
export class UmbMediaCollectionElement extends UmbCollectionDefaultElement {
@@ -13,16 +17,31 @@ export class UmbMediaCollectionElement extends UmbCollectionDefaultElement {
1317
@state()
1418
private _progress = -1;
1519

20+
@state()
21+
private _unique: string | null = null;
22+
1623
constructor() {
1724
super();
1825
this.consumeContext(UMB_MEDIA_COLLECTION_CONTEXT, (instance) => {
1926
this.#mediaCollection = instance;
2027
});
28+
this.consumeContext(UMB_MEDIA_WORKSPACE_CONTEXT, (instance) => {
29+
this.observe(instance.unique, (unique) => {
30+
this._unique = unique ?? null;
31+
});
32+
});
2133
}
2234

23-
#onChange() {
35+
async #onChange() {
2436
this._progress = -1;
2537
this.#mediaCollection?.requestCollection();
38+
39+
const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
40+
const event = new UmbRequestReloadChildrenOfEntityEvent({
41+
entityType: this._unique ? UMB_MEDIA_ENTITY_TYPE : UMB_MEDIA_ROOT_ENTITY_TYPE,
42+
unique: this._unique,
43+
});
44+
eventContext.dispatchEvent(event);
2645
}
2746

2847
#onProgress(event: UmbProgressEvent) {
@@ -33,7 +52,10 @@ export class UmbMediaCollectionElement extends UmbCollectionDefaultElement {
3352
return html`
3453
<umb-media-collection-toolbar slot="header"></umb-media-collection-toolbar>
3554
${when(this._progress >= 0, () => html`<uui-loader-bar progress=${this._progress}></uui-loader-bar>`)}
36-
<umb-dropzone @change=${this.#onChange} @progress=${this.#onProgress}></umb-dropzone>
55+
<umb-dropzone
56+
.parentUnique=${this._unique}
57+
@change=${this.#onChange}
58+
@progress=${this.#onProgress}></umb-dropzone>
3759
`;
3860
}
3961
}

src/packages/media/media/dropzone/dropzone-manager.class.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,15 @@ export class UmbDropzoneManager extends UmbControllerBase {
187187
fileExtensions: Array<string>,
188188
parentUnique: string | null,
189189
): Promise<Array<UmbUploadableExtensionModel>> {
190-
// Getting all media types allowed in our current position based on parent unique.
191-
const { data: allAllowedMediaTypes } = await this.#mediaTypeStructure.requestAllowedChildrenOf(parentUnique);
190+
let parentMediaType: string | null = null;
191+
if (parentUnique) {
192+
const { data } = await this.#mediaDetailRepository.requestByUnique(parentUnique);
193+
parentMediaType = data?.mediaType.unique ?? null;
194+
}
195+
196+
// Getting all media types allowed in our current position based on parent's media type.
197+
198+
const { data: allAllowedMediaTypes } = await this.#mediaTypeStructure.requestAllowedChildrenOf(parentMediaType);
192199
if (!allAllowedMediaTypes?.items.length) return [];
193200

194201
const allowedByParent = allAllowedMediaTypes.items;

src/packages/members/member-group/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ export * from './entity.js';
44
export * from './repository/index.js';
55
export * from './components/index.js';
66
export type { UmbMemberGroupDetailModel } from './types.js';
7+
8+
export { UMB_MEMBER_GROUP_PICKER_MODAL } from './components/member-group-picker-modal/index.js';
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import './input-member/input-member.element.js';
22

33
export * from './input-member/input-member.element.js';
4-
54
export * from './member-picker-modal/member-picker-modal.element.js';
5+
6+
export { UMB_MEMBER_PICKER_MODAL } from './member-picker-modal/index.js';

0 commit comments

Comments
 (0)