Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions assets/css/groups.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ input {
flex-direction: row;
}

.t42-html-buttons-container {
display: flex;
position: absolute;
right: var(--spacing-4);
top: var(--spacing-4);
background-color: Hsl(var(--g42-bg-01));
}

.t42-html-buttons-container ul:first-of-type {
padding-left: var(--spacing-4);
}

.t42-buttons {
display: flex;
flex-shrink: 0;
Expand Down Expand Up @@ -384,6 +396,10 @@ input {
background-color: var(--t42-tab-bar-background);
}

.t42-html-buttons-bar-element {
background-color: var(--t42-html-buttons-bar-background);
}

.t42-tab-bar-button {
width: var(--t42-tab-bar-button-size);
height: var(--t42-tab-bar-button-size);
Expand Down
2 changes: 2 additions & 0 deletions assets/css/vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
--t42-frame-caption-separator-size: 0;
--t42-frame-caption-background: Hsl(var(--g42-bg-01));

--t42-html-buttons-bar-background: Hsl(var(--g42-bg-01));

--t42-tab-bar-height: 32px;
--t42-tab-bar-button-size: 26px;
--t42-tab-bar-separator-size: 0;
Expand Down
148 changes: 126 additions & 22 deletions src/GroupElementCreationWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@ const GroupElementCreationWrapper: React.FC<GroupProps> = ({ components }) => {

const minimize = {
onClick: () => {
webGroupsManager.minimizeGroup(options.targetId);
webGroupsManager.onMinimizeButtonClick(TargetType.Group, options.targetId);
},
...options.minimize
}

const restore = {
onClick: () => {
webGroupsManager.restoreGroup(options.targetId);
webGroupsManager.onRestoreButtonClick(TargetType.Group, options.targetId);
},
...options.restore
}

const maximize = {
onClick: () => {
webGroupsManager.maximizeGroup(options.targetId);
webGroupsManager.onMaximizeButtonClick(TargetType.Group, options.targetId);
},
...options.maximize
}

const close = {
onClick: () => {
webGroupsManager.closeGroup(options.targetId);
webGroupsManager.onCloseButtonClick(TargetType.Group, options.targetId);
},
...options.close
}
Expand Down Expand Up @@ -102,63 +102,63 @@ const GroupElementCreationWrapper: React.FC<GroupProps> = ({ components }) => {

const feedback = {
onClick: () => {
webGroupsManager.feedbackFrame(options.targetId);
webGroupsManager.onFeedbackButtonClick(TargetType.Frame, options.targetId);
},
...options.feedback
};

const sticky = {
onClick: () => {
webGroupsManager.stickyFrame(options.targetId);
webGroupsManager.onStickyButtonClick(TargetType.Frame, options.targetId);
},
...options.sticky
};

const extract = {
onClick: () => {
webGroupsManager.extractFrame(options.targetId);
webGroupsManager.onExtractButtonClick(TargetType.Frame, options.targetId);
},
...options.extract
};

const lock = {
onClick: () => {
webGroupsManager.lockFrame(options.targetId);
webGroupsManager.onLockButtonClick(TargetType.Frame, options.targetId);
},
...options.lock
};

const unlock = {
onClick: () => {
webGroupsManager.unlockFrame(options.targetId);
webGroupsManager.onUnlockButtonClick(TargetType.Frame, options.targetId);
},
...options.unlock
};

const minimize = {
onClick: () => {
webGroupsManager.minimizeFrame(options.targetId);
webGroupsManager.onMinimizeButtonClick(TargetType.Frame, options.targetId);
},
...options.minimize
}

const restore = {
onClick: () => {
webGroupsManager.restoreFrame(options.targetId);
webGroupsManager.onRestoreButtonClick(TargetType.Frame, options.targetId);
},
...options.restore
}

const maximize = {
onClick: () => {
webGroupsManager.maximizeFrame(options.targetId);
webGroupsManager.onMaximizeButtonClick(TargetType.Frame, options.targetId);
},
...options.maximize
}

const close = {
onClick: () => {
webGroupsManager.closeFrame(options.targetId);
webGroupsManager.onCloseButtonClick(TargetType.Frame, options.targetId);
},
...options.close
}
Expand Down Expand Up @@ -402,63 +402,63 @@ const GroupElementCreationWrapper: React.FC<GroupProps> = ({ components }) => {

const feedback = {
onClick: () => {
webGroupsManager.feedbackTabBar(options.targetId);
webGroupsManager.onFeedbackButtonClick(TargetType.TabBar, options.targetId);
},
...options.feedback
};

const sticky = {
onClick: () => {
webGroupsManager.stickyTabBar(options.targetId);
webGroupsManager.onStickyButtonClick(TargetType.TabBar, options.targetId);
},
...options.sticky
};

const extract = {
onClick: () => {
webGroupsManager.extractTabBar(options.targetId);
webGroupsManager.onExtractButtonClick(TargetType.TabBar, options.targetId);
},
...options.extract
};

const lock = {
onClick: () => {
webGroupsManager.lockTabBar(options.targetId);
webGroupsManager.onLockButtonClick(TargetType.TabBar, options.targetId);
},
...options.lock
}

const unlock = {
onClick: () => {
webGroupsManager.unlockTabBar(options.targetId);
webGroupsManager.onUnlockButtonClick(TargetType.TabBar, options.targetId);
},
...options.unlock
}

const minimize = {
onClick: () => {
webGroupsManager.minimizeTabBar(options.targetId);
webGroupsManager.onMinimizeButtonClick(TargetType.TabBar, options.targetId);
},
...options.minimize
}

const restore = {
onClick: () => {
webGroupsManager.restoreTabBar(options.targetId);
webGroupsManager.onRestoreButtonClick(TargetType.TabBar, options.targetId);
},
...options.restore
}

const maximize = {
onClick: () => {
webGroupsManager.maximizeTabBar(options.targetId);
webGroupsManager.onMaximizeButtonClick(TargetType.TabBar, options.targetId);
},
...options.maximize
}

const close = {
onClick: () => {
webGroupsManager.closeTabBar(options.targetId);
webGroupsManager.onCloseButtonClick(TargetType.TabBar, options.targetId);
},
...options.close
}
Expand Down Expand Up @@ -505,6 +505,107 @@ const GroupElementCreationWrapper: React.FC<GroupProps> = ({ components }) => {
});
}

const renderHtmlButtons = () => {
const HtmlButtonsCustomElement = components?.html?.Buttons;

return Object.values(state.htmlButtons).map((te) => {
if (!HtmlButtonsCustomElement || !te.parentElement) {
return;
}
const { parentElement, ...options } = te;

const feedback = {
onClick: () => {
webGroupsManager.onFeedbackButtonClick(TargetType.HtmlButtons, options.targetId);
},
...options.feedback
};

const sticky = {
onClick: () => {
webGroupsManager.onStickyButtonClick(TargetType.HtmlButtons, options.targetId);
},
...options.sticky
};

const extract = {
onClick: () => {
webGroupsManager.onExtractButtonClick(TargetType.HtmlButtons, options.targetId);
},
...options.extract
};

const lock = {
onClick: () => {
webGroupsManager.onLockButtonClick(TargetType.HtmlButtons, options.targetId);
},
...options.lock
}

const unlock = {
onClick: () => {
webGroupsManager.onUnlockButtonClick(TargetType.HtmlButtons, options.targetId);
},
...options.unlock
}

const minimize = {
onClick: () => {
webGroupsManager.onMinimizeButtonClick(TargetType.HtmlButtons, options.targetId);
},
...options.minimize
}

const restore = {
onClick: () => {
webGroupsManager.onRestoreButtonClick(TargetType.HtmlButtons, options.targetId);
},
...options.restore
}

const maximize = {
onClick: () => {
webGroupsManager.onMaximizeButtonClick(TargetType.HtmlButtons, options.targetId);
},
...options.maximize
}

const close = {
onClick: () => {
webGroupsManager.onCloseButtonClick(TargetType.HtmlButtons, options.targetId);
},
...options.close
}

let customButtonsProps = new Array<CustomButtonProps>();
if (options.customButtons) {
customButtonsProps = options.customButtons.map((cButton) => {
return {
onClick: () => {
webGroupsManager.clickCustomButton(options.targetId, cButton.buttonId);
},
visible: true,
imageData: cButton.imageData,
tooltip: cButton.tooltip,
buttonId: cButton.buttonId}});
}

return <Portal key={options.targetId} parentElement={parentElement}><HtmlButtonsCustomElement {...options}
feedback={feedback}
sticky={sticky}
extract={extract}
lock={lock}
unlock={unlock}
minimize={minimize}
maximize={maximize}
restore={restore}
close={close}
customButtons={customButtonsProps}
frameId={options.targetId}
/></Portal>
});
}

return <>
{renderGroupCaptionBar()}
{renderGroupOverlay()}
Expand All @@ -520,6 +621,7 @@ const GroupElementCreationWrapper: React.FC<GroupProps> = ({ components }) => {
{renderAfterTabsZones()}
{renderTabHeaderButtons()}
{renderBelowTabs()}
{renderHtmlButtons()}
<GroupWrapper
onCreateGroupCaptionBarRequested={components?.group?.CaptionBar ? webGroupsStore.onCreateGroupCaptionBarRequested : undefined}
onCreateGroupOverlayRequested={components?.group?.Overlay ? webGroupsStore.onCreateGroupOverlayRequested : undefined}
Expand All @@ -535,6 +637,7 @@ const GroupElementCreationWrapper: React.FC<GroupProps> = ({ components }) => {
onCreateAfterTabsComponentRequested={components?.tabs?.After ? webGroupsStore.onCreateAfterTabsComponentRequested : undefined}
onCreateTabHeaderButtonsRequested={components?.tabs?.Buttons ? webGroupsStore.onCreateTabHeaderButtonsRequested : undefined}
onCreateBelowTabsRequested={components?.tabs?.Below ? webGroupsStore.onCreateBelowTabsComponentRequested : undefined}
onCreateHtmlButtonsRequested={components?.html?.Buttons ? webGroupsStore.onCreateHtmlButtonsRequested : undefined}
onUpdateGroupCaptionBarRequested={components?.group?.CaptionBar ? webGroupsStore.onUpdateGroupCaptionBarRequested : undefined}
onUpdateFrameWindowOverlayRequested={components?.group?.Overlay ? webGroupsStore.onUpdateFrameWindowOverlayRequested : undefined}
onUpdateFrameCaptionBarRequested={components?.flat?.CaptionBar ? webGroupsStore.onUpdateFrameCaptionBarRequested : undefined}
Expand All @@ -558,6 +661,7 @@ const GroupElementCreationWrapper: React.FC<GroupProps> = ({ components }) => {
onRemoveAfterTabsComponentRequested={webGroupsStore.onRemoveAfterTabsComponentRequested}
onRemoveTabHeaderButtonsRequested={webGroupsStore.onRemoveTabHeaderButtonsRequested}
onRemoveBelowTabsRequested={webGroupsStore.onRemoveBelowTabsRequested}
onRemoveHtmlButtonsRequested={webGroupsStore.onRemoveHtmlButtonsRequested}
onShowCaptionEditorRequested={webGroupsStore.onShowCaptionEditorRequested}
onCommitCaptionEditingRequested={webGroupsStore.onCommitCaptionEditingRequested}
onHideCaptionEditorRequested={webGroupsStore.onHideCaptionEditorRequested}
Expand Down
5 changes: 4 additions & 1 deletion src/GroupWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ class GroupWrapper extends React.Component<GroupWrapperProps> {
createTabBarButtonsContainerElement: this.props.onCreateTabHeaderButtonsRequested,
createBelowTabs: this.props.onCreateBelowTabsRequested,
updateBelowTabs: this.props.onUpdateBelowTabsRequested,


createHtmlButtonsContainerElement: this.props.onCreateHtmlButtonsRequested,
destroyHtmlButtonsContainerElement: this.props.onRemoveHtmlButtonsRequested,

updateFrame: this.props.onUpdateFrameRequested,
updateStandardButton: this.props.onUpdateStandardButtonRequested,
updateCustomButtons: this.props.onUpdateCustomButtonsRequested,
Expand Down
Loading