I have an issue with jeditable and trying to customize the style of the placeholder text.
$(".labeledit").editable("....", {
event: "click",
onblur: "submit",
width:($(".labeledit").width() + 40) + "px",
placeholder: "<span class='placeholder'>add label</span>",
tooltip: "Click to update"
});
In the placeholder text I add a span and associate a class. This works fine in the view but when I click on the add label text it places the placeholder text into the textbox so I get
<span class='placeholder'>add label</span>
appearing in the textbox.
If I just have placeholder: "add label" then the add label text doesn't show in the textbox.
What am I doing wrong?
Here it is! Instead of:
...
placeholder: "<span class='placeholder'>add label</span>",
...
try switching the quote marks:
...
placeholder: '<span class="placeholder">add label</span>',
...
Related
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
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:
I have two fields in dialog, image field and image alt text field. My requirement is to make the "image alt text" field mandatory if image is authored. But if image is not authored, then "image alt text" should not be mandatory.
how can we achieve in AEM 6.2 touch ui?
<image
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/fileupload"
autoStart="{Boolean}false"
class="cq-droptarget"
fieldDescription=“Authored Image"
fieldLabel="Image"
fileNameParameter="./fileName"
fileReferenceParameter="./fileReference"
mimeTypes="[image]"
multiple="{Boolean}false"
name="./imagedragdrop"
title="Upload Image Asset"
uploadUrl="${suffix.path}"
useHTML5="{Boolean}true"/>
<imageAltText
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldDescription=“Image alt text"
fieldLabel="Image Alt Text"
name="./imageAltText"/>
Here is a simple way to achieve this:
When the file upload widget is authored, it will have the class is-filled and when it's not authored, it will not have that class.
First:
We need to give both fields a special selector, I'm going with ID's:
Add the property id="file-upload-special" to your file upload dialog widget
Add the property id="alt-special" to your alt text (textfield) widget
Second:
Create a clientlib with the following categories="[cq.authoring.dialog]"
Third:
Add the following js to the clientlib:
// register a validator
$(window).adaptTo("foundation-registry").register("foundation.validation.validator", {
selector: "#alt-special", // validates the specific alt field
validate: function(el) {
var $el = $(el);
var $form = $el.closest('form'); // get the form
var $upload = $form.find('#file-upload-special'); // find the file-upload widget
if($upload.hasClass('is-filled') && !$el.val()){ // if class exists, return validation msg
return 'this field is required';
} else {
return;
}
}
});
now the alt field should only be validated if the file-upload is authored.
I created an action sheet containing some options
when I select an option I want it to be highlighted.
I took the code from here
https://ionicframework.com/docs/components/#action-sheets
can someone help me please
You can use some (S)CSS to style it with a pseudo-class like :active or :hover. To include your own CSS classes to the action sheet you could use its cssClass property when creating it. Like so:
let actionSheet = this.actionSheetCtrl.create({
title: 'Ionic Action Sheet',
cssClass: 'your-custom-class',
buttons: [
{
text: 'Button 1',
cssClass: 'custom-button-1-class',
handler: () => {
console.log("Button 1 picked!");
}
}
]
});
By doing that, you can use custom CSS classes to style each button (option) of your action sheet, as well as the action sheet itself. If you wanted to, say, make Button 1 have a black background whenever a user "activated" it, you could write:
.custom-button-1-class:active {
background-color: black;
}
I have a simple SQLform, where I'm trying to override the labels so they are more meaningful to the user :
form = SQLFORM(db.UserData, submit_button='Report now !', labels =
{'title':'Article Title', 'link':'Link to article',
'htmlcontent':'Content in HTML format', 'textcontent':'Content in text
format', 'source':'Your name', 'imageurl':'Image to the article',
'briefdescription':'Brief article excerpt', 'iscontentavailable':
'Ignore this'})
The labels for htmlContent, imageurl, briefdescription & textcontent are not being replaced.
Any idea what I should be checking or where I might be going wrong ?
You can get a easy name for your fields when defining your table, with labels:
db.define_table('system',
Field('version', label='System Version', length=4),
Field('db', label='System Database', length=10),
Field('modules', label='Modules loaded', length=50)
)
and Using placeholder HTML5 property with a custom form, you can put a tip into the textboxes:
{{=form.custom.begin}}
{{form.custom.widget.title['_placeholder']='Article Title'}}
{{form.custom.widget.link['_placeholder']='Link to article'}}
....
{{=form.custom.end}}
To add a label you can use jquery:
$('#title').val($('#title').val() + 'Article Title');