Skip to content

Commit 99ec164

Browse files
authored
Remove button group configuration from Rich Text Editor template for initial version (#3678)
* remove button groups from RTE template * remove button group config from ui prompting examples * add changeset * pnpm * pnpm * remove button group types from RTE
1 parent 8282c33 commit 99ec164

File tree

8 files changed

+15
-188
lines changed

8 files changed

+15
-188
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@sap-ux-private/ui-prompting-examples': patch
3+
'@sap-ux/fe-fpm-writer': patch
4+
---
5+
6+
Remove button group configuration from Rich Text Editor template for initial version

examples/ui-prompting-examples/src/RichTextEditor.story.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ export const ExternalValues = (): JSX.Element => {
1919
metaPath: {
2020
bindingContextType: 'absolute',
2121
entitySet: 'C_CustomerBankDetailsOP'
22-
},
23-
buttonGroup: {
24-
name: 'edit-actions',
25-
buttons: 'copy,paste,undo,redo',
26-
visible: false,
27-
priority: 20,
28-
customToolbarPriority: 5,
29-
row: 2
3022
}
3123
}
3224
}}

packages/fe-fpm-writer/src/building-block/prompts/questions/richTextEditor.ts

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import {
66
getEntityPrompt,
77
getTargetPropertiesPrompt,
88
getAggregationPathPrompt,
9-
getViewOrFragmentPathPrompt,
10-
getBooleanPrompt
9+
getViewOrFragmentPathPrompt
1110
} from '../utils';
1211
import type { PromptContext, Prompts } from '../../../prompts/types';
1312
import { BuildingBlockType, bindingContextAbsolute } from '../../types';
@@ -25,13 +24,6 @@ export async function getRichTextEditorBuildingBlockPrompts(
2524
context: PromptContext
2625
): Promise<Prompts<RichTextEditorPromptsAnswer>> {
2726
const t = translate(i18nNamespaces.buildingBlock, 'prompts.richTextEditor.');
28-
const defaultAnswers = {
29-
buttonGroup: {
30-
name: 'font-style',
31-
visible: true,
32-
buttons: 'bold,italic,underline'
33-
}
34-
};
3527

3628
return {
3729
questions: [
@@ -78,44 +70,11 @@ export async function getRichTextEditorBuildingBlockPrompts(
7870
guiOptions: {
7971
mandatory: true
8072
}
81-
}),
82-
{
83-
name: 'buildingBlockData.buttonGroup.name',
84-
type: 'input',
85-
message: t('buttonGroup.name') as string,
86-
default: defaultAnswers.buttonGroup.name
87-
},
88-
{
89-
name: 'buildingBlockData.buttonGroup.buttons',
90-
type: 'input',
91-
message: t('buttonGroup.buttons') as string,
92-
default: defaultAnswers.buttonGroup.buttons
93-
},
94-
getBooleanPrompt({
95-
name: 'buildingBlockData.buttonGroup.visible',
96-
message: t('buttonGroup.visible') as string,
97-
default: defaultAnswers.buttonGroup.visible
98-
}),
99-
{
100-
name: 'buildingBlockData.buttonGroup.priority',
101-
type: 'input',
102-
message: t('buttonGroup.priority') as string
103-
},
104-
{
105-
name: 'buildingBlockData.buttonGroup.customToolbarPriority',
106-
type: 'input',
107-
message: t('buttonGroup.customToolbarPriority') as string
108-
},
109-
{
110-
name: 'buildingBlockData.buttonGroup.row',
111-
type: 'input',
112-
message: t('buttonGroup.row') as string
113-
}
73+
})
11474
],
11575
initialAnswers: {
11676
buildingBlockData: {
117-
buildingBlockType: BuildingBlockType.RichTextEditor,
118-
buttonGroup: defaultAnswers.buttonGroup
77+
buildingBlockType: BuildingBlockType.RichTextEditor
11978
}
12079
}
12180
};

packages/fe-fpm-writer/src/building-block/types.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { integer } from '../../../text-document-utils/src';
2-
31
/**
42
* Building block type.
53
*
@@ -428,35 +426,6 @@ export interface RichTextEditor extends BuildingBlock {
428426
* Property used to construct the metaPath for Rich Text Editor, e.g. "/EntitySet/targetProperty".
429427
*/
430428
targetProperty?: string;
431-
/**
432-
* Button group configuration for the Rich Text Editor.
433-
*/
434-
buttonGroup?: {
435-
/**
436-
* The name of the button group.
437-
*/
438-
name: string;
439-
/**
440-
* The buttons to be displayed in the group.
441-
*/
442-
buttons: string;
443-
/**
444-
* Whether the group is visible.
445-
*/
446-
visible: boolean;
447-
/**
448-
* The priority of the group.
449-
*/
450-
priority: integer;
451-
/**
452-
* The priority of the group in the custom toolbar.
453-
*/
454-
customToolbarPriority?: integer;
455-
/**
456-
* Row number in which the button group should be.
457-
*/
458-
row?: integer;
459-
};
460429
}
461430

462431
/**
Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,3 @@
1-
<%
2-
const attrs = [
3-
`name="${data.buttonGroup.name}"`,
4-
`buttons="${data.buttonGroup.buttons}"`,
5-
`visible="${data.buttonGroup.visible}"`
6-
];
7-
if (typeof data.buttonGroup.priority !== 'undefined') {
8-
attrs.push(`priority="${data.buttonGroup.priority}"`);
9-
}
10-
if (typeof data.buttonGroup.customToolbarPriority !== 'undefined') {
11-
attrs.push(`customToolbarPriority="${data.buttonGroup.customToolbarPriority}"`);
12-
}
13-
if (typeof data.buttonGroup.row !== 'undefined') {
14-
attrs.push(`row="${data.buttonGroup.row}"`);
15-
}
16-
%>
171
<<%- macrosNamespace %>:RichTextEditorWithMetadata
182
metaPath="<%- data.metaPath %>"
19-
id="<%- data.id %>">
20-
<<%- macrosNamespace %>:buttonGroups>
21-
<richtexteditor:ButtonGroup
22-
<% attrs.forEach(attr => { %> <%- attr %>
23-
<% }); %> />
24-
</<%- macrosNamespace %>:buttonGroups>
25-
</<%- macrosNamespace %>:RichTextEditorWithMetadata>
3+
id="<%- data.id %>"/>

packages/fe-fpm-writer/test/unit/__snapshots__/building-block.test.ts.snap

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,11 +1162,7 @@ exports[`Building Blocks generates Rich Text Editor building block with absolute
11621162
"<core:FragmentDefinition xmlns:core=\\"sap.ui.core\\" xmlns=\\"sap.m\\" xmlns:macros=\\"sap.fe.macros\\" xmlns:richtexteditor=\\"sap.fe.macros.richtexteditor\\">
11631163
<VBox>
11641164
<Text text=\\"Custom section\\"/>
1165-
<macros:RichTextEditorWithMetadata metaPath=\\"/testEntitySet/testProperty\\" id=\\"testRichTextEditor\\">
1166-
<macros:buttonGroups>
1167-
<richtexteditor:ButtonGroup name=\\"font-style\\" buttons=\\"bold,italic,underline\\" visible=\\"true\\"/>
1168-
</macros:buttonGroups>
1169-
</macros:RichTextEditorWithMetadata>
1165+
<macros:RichTextEditorWithMetadata metaPath=\\"/testEntitySet/testProperty\\" id=\\"testRichTextEditor\\"/>
11701166
</VBox>
11711167
</core:FragmentDefinition>"
11721168
`;
@@ -1175,11 +1171,7 @@ exports[`Building Blocks throws error for Rich Text Editor building block if UI5
11751171
"<core:FragmentDefinition xmlns:core=\\"sap.ui.core\\" xmlns=\\"sap.m\\" xmlns:macros=\\"sap.fe.macros\\" xmlns:richtexteditor=\\"sap.fe.macros.richtexteditor\\">
11761172
<VBox>
11771173
<Text text=\\"Custom section\\"/>
1178-
<macros:RichTextEditorWithMetadata metaPath=\\"_testNavigation/testProperty\\" id=\\"testRichTextEditor\\">
1179-
<macros:buttonGroups>
1180-
<richtexteditor:ButtonGroup name=\\"font-style\\" buttons=\\"bold,italic,underline\\" visible=\\"true\\" priority=\\"2\\" customToolbarPriority=\\"10\\" row=\\"1\\"/>
1181-
</macros:buttonGroups>
1182-
</macros:RichTextEditorWithMetadata>
1174+
<macros:RichTextEditorWithMetadata metaPath=\\"_testNavigation/testProperty\\" id=\\"testRichTextEditor\\"/>
11831175
</VBox>
11841176
</core:FragmentDefinition>"
11851177
`;

packages/fe-fpm-writer/test/unit/building-block.test.ts

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -848,12 +848,7 @@ describe('Building Blocks', () => {
848848
bindingContextType: bindingContextAbsolute,
849849
entitySet: 'testEntitySet'
850850
},
851-
targetProperty: 'testProperty',
852-
buttonGroup: {
853-
buttons: 'bold,italic,underline',
854-
name: 'font-style',
855-
visible: true
856-
}
851+
targetProperty: 'testProperty'
857852
};
858853

859854
fs.write(join(basePath, xmlFragmentFilePath), testXmlFragmentContent);
@@ -882,15 +877,7 @@ describe('Building Blocks', () => {
882877
bindingContextType: bindingContextRelative,
883878
entitySet: '_testNavigation'
884879
},
885-
targetProperty: 'testProperty',
886-
buttonGroup: {
887-
buttons: 'bold,italic,underline',
888-
name: 'font-style',
889-
visible: true,
890-
customToolbarPriority: 10,
891-
priority: 2,
892-
row: 1
893-
}
880+
targetProperty: 'testProperty'
894881
};
895882

896883
fs.write(join(basePath, xmlFragmentFilePath), testXmlFragmentContent);
@@ -919,12 +906,7 @@ describe('Building Blocks', () => {
919906
bindingContextType: bindingContextAbsolute,
920907
entitySet: 'testEntitySet'
921908
},
922-
targetProperty: 'testProperty',
923-
buttonGroup: {
924-
buttons: 'bold,italic,underline',
925-
name: 'font-style',
926-
visible: true
927-
}
909+
targetProperty: 'testProperty'
928910
};
929911

930912
const manifestWithLowerUi5Version = {

packages/fe-fpm-writer/test/unit/prompts/__snapshots__/prompts.test.ts.snap

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,11 +1741,6 @@ Object {
17411741
"initialAnswers": Object {
17421742
"buildingBlockData": Object {
17431743
"buildingBlockType": "rich-text-editor",
1744-
"buttonGroup": Object {
1745-
"buttons": "bold,italic,underline",
1746-
"name": "font-style",
1747-
"visible": true,
1748-
},
17491744
},
17501745
},
17511746
"questions": Array [
@@ -1834,52 +1829,6 @@ Object {
18341829
"name": "aggregationPath",
18351830
"type": "list",
18361831
},
1837-
Object {
1838-
"default": "font-style",
1839-
"message": "Button Group Name",
1840-
"name": "buildingBlockData.buttonGroup.name",
1841-
"type": "input",
1842-
},
1843-
Object {
1844-
"default": "bold,italic,underline",
1845-
"message": "Buttons",
1846-
"name": "buildingBlockData.buttonGroup.buttons",
1847-
"type": "input",
1848-
},
1849-
Object {
1850-
"choices": Array [
1851-
Object {
1852-
"name": "False",
1853-
"value": false,
1854-
},
1855-
Object {
1856-
"name": "True",
1857-
"value": true,
1858-
},
1859-
],
1860-
"default": true,
1861-
"guiOptions": Object {
1862-
"selectType": "static",
1863-
},
1864-
"message": "Visible",
1865-
"name": "buildingBlockData.buttonGroup.visible",
1866-
"type": "list",
1867-
},
1868-
Object {
1869-
"message": "Priority",
1870-
"name": "buildingBlockData.buttonGroup.priority",
1871-
"type": "input",
1872-
},
1873-
Object {
1874-
"message": "Custom Toolbar Priority",
1875-
"name": "buildingBlockData.buttonGroup.customToolbarPriority",
1876-
"type": "input",
1877-
},
1878-
Object {
1879-
"message": "Row",
1880-
"name": "buildingBlockData.buttonGroup.row",
1881-
"type": "input",
1882-
},
18831832
],
18841833
}
18851834
`;

0 commit comments

Comments
 (0)