Skip to content

Conversation

@shardulvs
Copy link
Contributor

Change-Id: Id30888c170500bd6dfc369fac6b1efe5da17296d

  • Resolves: #
  • Target version: main

Summary

TODO

  • ...

Checklist

  • I have run make prettier-write and formatted the code.
  • All commits have Change-Id
  • I have run tests with make check
  • I have issued make run and manually verified that everything looks okay
  • Documentation (manuals or wiki) has been updated or is not required

@eszkadev
Copy link
Contributor

eszkadev commented Feb 9, 2026

please rebase on top of main and solve conflict


JSDialog.notebookbarIconViewList = function (
parentContainer: Element,
data: any,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add dedicated type for it in Definitions.Types.ts, it helps as a documentation and prevents mistakes

commonContainer,
);
iconviewsWrapper.id = 'masterpage_icons-wrapper';
for( let i = 0; i < data.items.length; i++)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that loop the only difference we need?
I would suggest to not copy paste code. It's duplicated and change in one instance requires change in other too. Best would be to share a code...

How?

  • please use Object Oriented Programming here, and some trick:
  • wrap all original functions in a class NotebookbarIconViewList (parent class is more general)
  • extract the inner icon view creation (this commented piece) in a separate function which takes array of icon views data
  • please create subclass which extends the original one as NotebookbarIconView (single, narrower functionality), change the constructor so it takes regular icon view data and reuse parent class, just convert JSON to your "iconviewlist" format :)

Copy link
Contributor Author

@shardulvs shardulvs Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed duplicate code by wrapping notebookbarIconViewList with notebookbarIconView. Let me know if you'd prefer OOP

{
'id': 'masterpageall_icons', // has to match core id
'type': 'iconview',
'label': 'Presentation Templates'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

label should be translatable: _( ...text... )

@eszkadev
Copy link
Contributor

eszkadev commented Feb 9, 2026

Previews are not shown on first opening of a dropdown:
Kooha-2026-02-09-06-16-06.webm

This is caused by eventing design in JSDialog... we need to find inside a component the widget with id matching id of the core widget. Then we call function on it (see executeActionImpl in builder)

On demand rendering requests previews when item is shown. Then when we receive response we need to find the widget. But your new widget is not the thing we will find. We try to apply change in "child iconviews" directly (id=*current*, id= *all*). So we need to be sure these icon views have updateRender method. It was done in:

       commonContainer.updateRenders = iconview.updateRenders = (pos: number) => {
		iconview.updateRendersImpl(pos, data.id, iconview);

		// also update the dropdown (if any);
		const dropdownContainer = JSDialog.GetDropdown(data.id);
		if (dropdownContainer)
			iconview.updateRendersImpl(pos, data.id, dropdownContainer);
	};

but I think the dropdown container id is not good in new case?

@shardulvs shardulvs force-pushed the add-current-masterpages branch from e157312 to 8fa47f0 Compare February 9, 2026 21:22
@shardulvs
Copy link
Contributor Author

Previews are not shown on first opening of a dropdown: Kooha-2026-02-09-06-16-06.webm

fixed

@caolanm caolanm force-pushed the add-current-masterpages branch from 8fa47f0 to 3bc45f6 Compare February 10, 2026 08:38
Signed-off-by: Shardul Vikram Singh <[email protected]>
Change-Id: Id30888c170500bd6dfc369fac6b1efe5da17296d
@caolanm caolanm force-pushed the add-current-masterpages branch from 3bc45f6 to 537f76c Compare February 11, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Review

Development

Successfully merging this pull request may close these issues.

2 participants