tinymce-how to disable paste formatting options pop? - formatting

I am using tinyMCE for pasting text or table. Whenever I paste table, it popup a message asking "Paste Formatting Options" to choose "remove formatting" and "keep formatting".
I want to set it to "remove formatting" directly without prompting the message.
Can anyone share some experiences?

That dialog is only part of a paid premium plugin called PowerPaste - if you have questions regarding that plugin you should open a support case with Tiny and we can address your questions/issues.

setInterval(function () {
var selectorRemoveFormatting = $("button[title='Remove Formatting']");
if (selectorRemoveFormatting.length) {
selectorRemoveFormatting.click();
}
}, 100);
Hope I am not late but this is not the best solution, popup will display and go away.

You can set powerpaste_word_import and power_past_html_import to 'clean' instead of default 'promt'
tinymce.init({
selector: '#tinymce',
plugins: 'powerpaste',
powerpaste_word_import: 'clean',
powerpaste_html_import: 'clean',
});

Related

How to associate chrome extension with specific tab?

I am opening chrome extension in a tab instead of pop up with following code:
chrome-extension://xxxxxxxxxxxxxxxxxx/popup.html
But when I do so the extension doesn't get associated with other tab I want to use this extension for. Is there a way I can explicitly tell extension which tab it needs listen to?
From what I researched it's not possible and it is depends on the extension source code. I was able to make adjustments into source code function to create a workaround.
This is how extension selected tab:
chrome.tabs.query({
active: true,
currentWindow: true
}, (tabs) => {
var tab = tabs[0];

Vue: Why is my dialog not showing up when the right condition is set?

EDIT: I answered my own question. I don't know how to mark this as resolved, since SO doesn't allow me to vote my own answer right now. Thanks everyone.
I am trying to create a confirmation box (asking to remove a layout) in which the user has to press confirm or cancel - confirm means 'yes, remove the layout and close the confirmation box', cancel means 'just close the box'.
The confirmation box opens when a user presses RemoveButton - this means that RemoveButton doesn't do the job of "removing" until confirm is pressed. Clicking the RemoveButton should make the dialog to show up.
The problem is the my dialog is not showing up. I ran Chrome dev tool and made sure that setShowRemoveLayoutDialog(true) is working, but removeLayoutDialog is not opening. Even when I set a dev tool breakpoint on public removeLayout(layoutName: string), the dev tool could never reach it.
Can anyone tell me what I am doing wrong?
(We don't have to talk about CSS here since it is already built by my other teammates)
(I cannot do .confirm(confirm message) because it will trigger a no-alert error for lint. So I have to insert it into template and make a div or element for that).
Thank you!
This is my Vue/html template:
<RemoveButton #press="setShowRemoveLayoutDialog(true)">
<removeLayoutDialog v-if="showRemoveLayoutDialog"
:layout-name="props.node.name"
#confirm="removeLayout"
#cancel="setShowRemoveLayoutDialog(false)"/>
</RemoveButton>
This is my <script>:
#Component({
removeLayoutDialog,
...
})
export default class ThisClass {
...
public showRemoveLayoutDialog = false;
public removeLayout(layoutName: string) {
this.doRemoveLayout(layoutName);
this.showRemoveLayoutDialog = false;
}
public setShowRemoveLayoutDialog(isShown: boolean) {
this.showRemoveLayoutDialog = isShown;
}
}
I realized that having the dialog inside the button was the problem.
Instead of having <button ... <dialog></dialog> </button>, having <button><dialog> solved the problem.

Wix element comes on and off when I hover on it?

I'm building a website using Wix.com and I'm trying to add a feature with code. I want a button to appear only when I hover over a document on the page. So far the button appears the way I want, but when I try to click on it, it keeps flickering so it's hard for me to click it.
I'm pretty new to this so I just tried basic debugging But still I don't know why this is happening. Also, I couldn't find much help from Wix forum
here are the code and a screenshot from the site (code examples is the button)
let rollLeft = {
"duration": 200,
"direction": "left"
};
let rollRight = {
"duration": 200,
"direction": "right"
};
$w.onReady(function () {
//TODO: write your page related code here...
});
export function document15_mouseIn(event) {
//Add your code for this event here:
if(!$w('#button1').isVisible)
{
$w('#button1').show("roll", rollLeft);
}
}
export function document15_mouseOut(event) {
//Add your code for this event here:
if($w('#button1').isVisible)
{
$w('#button1').hide("roll", rollRight);
}
}
Without seeing it in action this is a bit of a guess, but it looks like when you move to the button, you leave the pdf, causing the button to hide.
I can think of at least two ways to get around this:
Add a delay to the effect options to give a user enough time to click the button before it starts to disappear.
Add a transparent box beneath the file icon and the button. Use that box to trigger the show and the hide on hover, instead of the file icon. That way the hide won't trigger when the user tries to click the button.

How to add a button in KeystoneJs Admin GUI to call function

Does anyone know if it's possible to add a button in the KeystonJs admin for example in the User model. I would like to have a set of fields and enable an admin to click "Add another" which will create a new field/row of fields.
So I just want that button to call a function. Something like this:
{ addItem: { type: Types.Button, label: 'Add another', actions: addItem() }}},
To add a button on KeystoneJs Admin GUI, you have to modify and build upon its's source. There is no way you can do that in this release (4.0).
There are discussions on their GitHub issues page and it may land in next version but no promises made yet.

TinyMCE remove item from context menu

Can any one please let me know how we can remove items from a TinyMCE ContextMenu. I.e., normal Cut, Copy, Paste items?
I've seen several references to add items to the context menu shown inside the editor, but not for removing the same.
Please help :)-
When you initiate TinyMCE, you can explicitly state which buttons to include:
tinyMCE.init({
...
theme_advanced_buttons1 : "bold,italic,underline",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : ""
});
(example taken from the docs)
Edit
Sorry, the question is about the Context Menu (a.k.a the right-click menu).
Have you tried this plugin which lets you do this?:
tinymce.init({
plugins: "contextmenu",
contextmenu: "link image inserttable | cell row column deletetable"
});