I want to add a button to a markitup set by which i can toggle preview, that is if i click on preview button i can see the preview, if i want to hide the preview - i can hide it by using that button. I've googleed for this but still no result. Any idea how to do that?
Nevermind, i've figured it out. I've added a button to hide it, code as below -
{name:'Hide Preview', call: function (markitUp){ miu.hidepreview()}, className:'hidepreview'}
Where hidepreview() as my custom function. I defined this function as below
miu = {
hidepreview : function(){
$('.markItUpPreviewFrame').remove();
}
}
It works for me.
You can do it by holding the Alt key and clicking on the Preview button - this will close the opened preview window.
It's in the else if statement of the preview() function:
} else if (altKey === true) {
if (iFrame) {
iFrame.remove();
} else {
previewWindow.close();
}
previewWindow = iFrame = false;
}
Related
In Nativescript Angular, I can swipe from left edge to right to go back on iOS. Is there any way i can detect or capture this swipe back?
The reason for this is because I have a button on screen that execute "this.routerExtensions.back()" when tapped. I would like to identify whether a "Back action" is from this button or iOS swipe event.
Thanks
NativeScript has this property on pages.
https://docs.nativescript.org/api-reference/classes/ui_page.page.html#enableswipebacknavigation
If you set that to false, you should then be able to create your own gesture for going back. Even on native iOS, I am not sure you can directly tap into the back gesture without instead replacing it with your own.
This is how I was able to solve it for Android and iOS:
adjust constructor to manipulate the pullToLeft function from Android, and disable the default swipe back from iOS:
constructor(...) {
if (isAndroid) {
Application.android.on(
AndroidApplication.activityBackPressedEvent,
(data: AndroidActivityBackPressedEventData) => {
data.cancel = true;
...yourCustomFunction()
}
);
} else {
page.enableSwipeBackNavigation = false;
}
}
for Android it is already working - for iOS you need then to write a function you can use on a template (this is also how you can recognize the swipe action):
public onSwipe = (args: SwipeGestureEventData) => {
if (!isAndroid) {
if (args.direction === SwipeDirection.right) {
...yourCustomFunction()
}
}
};
disable the default PopGestureSerializer and add the swipe function on top of your template/element and it should work on iOS as well:
<StackLayout [interactivePopGestureRecognizer]="false" (swipe)='onSwipe($event)'>
...
</StackLayout>
How can I make edit button work in a data table in angular 7. I would also like to know how to load a component on button click,
Ok here is my idea to acheive it
First for a button to work we use (click)
<button (click)="toggledata()">Show</button>
<demo-component *ngIf="value"></demo-component>
.ts
value = false;
toggledata() {
this.value = !this.value;
}
I have been using the EasyTipView swift library for a couple of days, however i am not able to make a particular tip dismiss, i can only make the tip disappear if i tap on it.
This is my sample code:
// Mostramos el tooltip al usuario
EasyTipView.show(forItem: self.buttonRefresh, text: "Refresh Button Tip".localized)
The tip will appear below the "buttonRefresh" element in my navigation bar, what i would like to accomplish is that tapping on that same button, the tip disappears.
You can find the library here: https://github.com/teodorpatras/EasyTipView
Thanks in advance
Alex
EasyTipView has a member function called dismiss. But to be able to use that you need to have an EasyTipView member variable in your class.
Once you have that , you can call dismiss to remove the EasyTipView window.
var easyTipView : EasyTipView!
...
...
func handleRefresh()
{
if self.easyTipView == nil
{
self.easyTipView = EasyTipView(text: "Hello There")
self.easyTipView.show(animated: true, forView: self.buttonRefresh!, withinSuperView: nil)
}
else
{
self.easyTipView.dismiss()
self.easyTipView = nil
}
}
Simply, you can do something like this:
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.tipView?.dismiss()
self.tipView = nil
}
I am using Kendo UI editor for my project (MVC 4 application).
In the button click event I need to display the editor text in another div once user enters the text and clicks on the preview button.
How do I do this?
Try this:
function getClick(e) {
try { //the name of your editor
var editor = $("#editor").data("kendoEditor");
var editorContent = editor.value();
alert(editorContent);
//Do Your stuff here
}
catch (e) { }
}
then call with a button
<button class="k-button" id="btnPreviewContent" onclick="getClick()">PreviewEditor Content</button>
I have a toolbarbutton and I want it to toggle a toolbox > toolbar when it is clicked. I thought there might be an internal function similar to toggleSidebar(id) but I cannot find it.
Well there is no function, however there is a simple solution for anyone looking for it.
First on the toolbarbutton add the following attribute:
oncommand="extName.toggleToolbar(event);"
then in the javascript:
toggleToolbar: function(e) {
var toolbar = document.getElementById('uniqueName-toolbar');
if(toolbar.getAttribute('hidden')== 'true'){
toolbar.setAttribute('hidden', false);
}
else{
toolbar.setAttribute('hidden', true);
}
}