sap.ushell.ui.shell.ShellHeadItem does not show the text - sapui5

In the SAPUI5 documentation they have the following example for adding a header item to the launchpad top header toolbar.
var oRenderer = sap.ushell.Container.getRenderer("fiori2");
// Create an icon button that opens a dialog
oRenderer.addHeaderEndItem({
id: "myTestButton",
icon: "sap-icon://action-settings",
tooltip: resources.i18n.getText("testButton.tooltip"),
text: resources.i18n.getText("testButton.text"),
ariaLabel: resources.i18n.getText("testButton.ariaLabel"),
ariaHaspopup: "dialog"
press: [myController.handleTestButtonPress, myController]
}, true);
// Create a temporary link
oRenderer.addHeaderEndItem({
id: "myTestLink",
ariaLabel: resources.i18n.getText("testLink.label"),
target: "#MyTestApplication-show"
icon: "sap-icon://overflow"
}, true, true);
I have tested this snippet, unfortunately it only shows icon and it does not show any text, however the tooltip works!
Anybody have any idea that how can I force sap.ushell.ui.shell.ShellHeadItem to show text instead of icon!? Or at least show both icon and text!
When I only set the text and do not set the icon property it will show this result:

Related

selection.getContent({format: 'html'}) returns text unless I select all text in the editor

I am trying to manipulate the html content of text that is selected in the editor. tinymce.activeEditor.getContent({format: 'html'}); grabs all of the html content in the editor which is great but I want the html of selected/highlighted text. I was under the impression that using tinymce.activeEditor.selection.getContent({format: 'html'}); would achieve this but it only returns html if all of the text in the editor is selected.
Here is my code:
setup: function (ed) {
ed.addButton('customFormatSelect', {
type: 'menubutton',
text: 'Formats',
icon: false,
menu: [{
text: 'Get HTML',
icon: false,
onselect: function() {
alert(tinymce.activeEditor.selection.getContent({format: 'html'}));
}
}]
});
}
I have tried using onclick instead of onselect and still get the same result.
Here are some screenshots of the issue:
Here is me selecting the text I want the HTML from and clicking my 'Get HTML' button:
Image 1
Here is the alert that I get:
Image 2

Activate command in CKEditor 5 drop down

I am trying to create a drop down menu in CKEditor 5 toolbar.
function createKMDropdown(editor, menuName, menuLabel, icon, commands) {
editor.ui.componentFactory.add(menuName, locale => {
const dropdownView = createDropdown(locale);
const items = new Collection();
commands.forEach(command => {
items.add({
type: 'button',
model: new Model({ withText: true, command: command, label: command }),
});
});
dropdownView.buttonView.set({
withText: true,
label: menuLabel,
tooltip: true
});
addListToDropdown(dropdownView, items);
return dropdownView;
});
}
class StyleMenu extends Plugin {
init() {
const { editor } = this;
const commands = ['strikethrough', 'subscript', 'superscript'];
createKMDropdown(editor, 'StyleMenu', 'Style', '', commands);
}
}
Question / Problems
I got the drop down show up, but clicking the item 'subscript" has no effect
Subscript is a plugin from CKEditor. How can I get its localized name show up in the drop down? Currently, I hard coded 'Subscript' in the plugin that does not work when user's locale is not English.
How can I access the icon of the plugins?
The drop down needs icon and localized name. If I want to choose "Cut" (or its localized version in other languages) and its icon for the drop down? How can I access it? In CKEditor 4, I can get hold of any icons and strings from the plugins.

How to add an image in shell header on a freestyle portal site?

I need to add an image on the header of a freestyle portal site which when clicked should open a new window with a specific URL.
Currently tried adding the below code but it appears very small, just like a profile picture. But our requirement is to make it appear more like a logo and on the right side (as an header end item).
var oImageItem = new sap.ushell.ui.shell.ShellHeadItem("imageId", {
icon: "/images/image1.png",
tooltip: "Click here",
//height: "100%",
showSeparator: false,
href: "HarcodeURL",
target: "_blank"
});
oRendererExtensions.addHeaderEndItem(oImageItem);
This link could be very interesting: How to place logo or icon at the Center of Unified Shell header?
You have to change "Center" to "Right" and "Icon" to "Image"
That would look like this:
var oShell = new sap.ui.unified.Shell("oShell", {
header: [
new sap.m.FlexBox({
justifyContent: sap.m.FlexJustifyContent.Center,
items: [
new sap.ui.core.Icon({
src: "sap-icon://home"
})
]
})
]
});
You also could change the "FlexBox" to a "VBox".
This element doesn't exist. Use the "sap.m.Image" element. (SDK sap.m.Image)
Code with XML: <m:Image src="/images/image1.png" width="100px" press="openNewWindow">
Code with JS:
var oImageItem = new sap.m.Image("imageId", {
src: "/images/image1.png",
tooltip: "Click here",
width: "100px",
press="openNewWindow"
});
Press Event in Controller:
openNewWindow: function(){
window.open("https://www.hypej.com");
},

Background page is scrolling but not the popup Modal

There is a link in the input form to a popup window to pickup subject categories. The popup window (modal) is a long list but it is not scrolling. If I am trying to scroll then the input form is scrolling and not the popup window. The popup window is moving up with the input form. I want the popup window to scroll, so that I can go through the list of 'subject categories' to select. I am trying to modified this open source software code for my local use.
function(resultingHtml){
//retrieve the dialog box
var $Result = $('<div></div>').html(resultingHtml);
var mainDialogDivision = $Result.find('div[id^=aspect_submission_ControlledVocabularyTransformer_div_vocabulary_dialog_]');
$('body').append($(mainDialogDivision[0]));
var vocabularyDialog = $('div#aspect_submission_ControlledVocabularyTransformer_div_vocabulary_dialog_' + vocabularyIdentifier);
vocabularyDialog.dialog({
autoOpen: true,
overflow: scroll,
height: 450,
width: 650,
modal: true,
title: $Result.find('title').html()
});
You should be able to accomplish this using CSS. Adding style overflow:auto to the main modal element should allow you to scroll through all the subject categories.
You don't mention which DSpace theme you are using, so I assume you are using theme Mirage (the default DSpace theme), then adding the following CSS to the style.css file of your theme should solve your scrolling problem:
.ui-dialog.ui-widget.ui-widget-content
{
overflow: auto
}

how to hide / show ionic popup buttons dynamically

I am on my first big ionic project and am stuck. Would someone have an idea how to dynamically hide and show buttons in an ionic popup? I need the buttons to initially be hidden, but then after something happens the buttons should show up. Any idea how to get that done?
Trying to explain further, what is required here is provide angular directives inside of the $ionicPopup buttons. eg
buttons: [{
text: 'Cancel'
}, {
text: '<b ng-disabled="user.length<1">Delete</b>',
type: 'button-crimson'
}]
But ng-disabled="user.length<1" gets trimmed when the pop-up is rendered.
If you're still looking for an answer to this...
I created a variable for my buttons array
var buttons = [{...}, {...}]
Then would assign that to the object in the popup
$ionicPopup.show({
templateUrl: 'templates/pop-up.html',
title: 'My Popup',
subTitle: 'stuff,
scope: $scope,
**buttons: buttons,**
And then would alter that array
buttons.splice(0, 1, {/*new button*/})
I haven't tested it but it might also work if you wanted to edit a title or class
buttons[0].type = 'newCssClass';
My work-around has been to put the dynamic buttons in the template of the popup rather than the buttons array. It's not ideal but it will work.
eg:
addPopup = $ionicPopup.show({
templateUrl: 'templates/pop-up.html',
title: 'My Popup',
subTitle: 'stuff,
scope: $scope,
buttons: [{
text: 'Cancel',
And then in pop-up.html you can do your usual angular ng-if/ng-hide/ng-disabled/etc stuff like normal. The downside is that those buttons wont show up along the bottom where the ones in the array go, but with some styling work you can make it still look nice.
It should be easy using $scope variables and ng-hide/ng-show
function something_happens(){
$scope.it_happened = true;
}
<button ng-show="it_happened">Qlik Me</button>
The button will only display if $scope.it_happened == true