Is it possible to ask before pasting to retain formats in Tinymce Editor? Few days back i found that demo in which on pasting any content in editor it was asking to retain formats on not. Now i am unable to find that Tinymce demo link. Need your help and assistance.
Take a look at the paste_preprocess setting.
You can use a regular javascript user dialog inside the function.
Depending on the user action you may remove whatever you like from the pasted content.
Related
I am trying to add in a program or script to a OneNote Page that will allow me to change select which part is needed and change the quantity and have it spit out the text format seen next to it. I'm not sure if this can be done using xml or if I would have to use C#.
UI look
The videos and documentation I find online are not very helpful or maybe I'm confusing myself
I've searched the web for 2 days now and am about to give up on this, but I'm soo close to the final solution... so you're my last hope. ;)
I have made a little C# application with Windows Forms GUI that uses a webBrowser element to display an HTML file with a TinyMCE editor embedded - this way I get a nice window with customizable editor functions I can use perfectly for my needs in this project.
I can set the textarea input for this editor window without problems thanks to this solution posted here on stackoverflow: https://stackoverflow.com/a/16322324/3498545
However I'm having big troubles reading text from this textarea. If I read the element by ID as shown (for setting content) in the solution above, I get the old text, as TinyMCE never really saves the changes.
But how do I get the input that my users will make in the textarea via TinyMCE? Is there some way to trigger a form send in HTML to get this input?
Thank you so much for you help!
Ok, to answer my own question (maybe others find this useful sometime later):
The changes of TinyMCE don't get written back to the textarea field in realtime, so I had to work around that. One solution would be to add something in the javascript header that writes every change back to the textarea immediately, however this caused problems for me as TinyMCE code clean up is not involved at this point.
My solution was to temporarily create a new file where the input of the TinyMCE field gets written directly into source code, which is a piece of cake to read back in C#.
The javascript code needed looks like this:
setup : function(editor){
editor.on('submit', function (){
tinymce.triggerSave();
document.writeln("<!DOCTYPE html><html><body><div id='content'>"+document.getElementById('textarea').value+"</div></body></html>")
document.close()
});
}
After that you can read the content in C# with the following code:
webBrowser.Document.GetElementById("content").InnerHtml
Now I can store HTML formatted code in my SQL database that can be managed and edited with a shiny interface. ;)
I created a web page in ASP.NET 4.0.
I'm using MarkdownDeep library (http://www.toptensoftware.com/markdowndeep/) to convert some text to HTML.
I found an issue that I can't fix. I hope you can help me.
I have some kind of forum, a want to post some code into the comment and see the indentation.
In the markdown preview editor, the text looks good. I save the textarea content to a database I show in the page, and I looks good.
For example, I try show two element tags of html to see the indentation on the code.
If I see the code with Chrome Development Tools, I look this:
<pre><code><head>
<title>
</code></pre>
It shows like this:
Everything is fine. But, if I reload the page, it appears like this
<pre><code><head><title>
</code></pre>
And it shows like this:
What I'm doing is:
write some text in the textarea
save text to the database
bring text back from database
converting markdown to html with the Transform() method of MarkdownDeep
put the result to the a Label's Text property
I tried, converting markdown before saving to the database, but nothing changes.
Ok, I finally found the solution.
That code was in a page that have a masterpage. If I took away the masterpage, everything is fine.
I don't know why... but that issue dissapear.
I am facing a pesky problem at the moment on a large website with multiple languages. On arrival at the website, it detects what country you are from and prompts you to confirm this. On confirmation, it swaps out the pages languages from the DB and displays the relevant language. This is done using jQuery. Now the problem is that Arabic reads rtl, so I need to either:
-- swap out the stylesheets for "rtl" version
or
-- change the HTML tag and include a "dir='rtl'" arrtribute
Now, I have tried both of these, with failures on both. When I view the page source, it still shows the old Css file or HTML tag without the "dir" attribute. Correct me if I'm wrong but I believe this to be due to the DOM not registering the new changes, as they have happened asynchronously via jQuery after the DOM has been instantiated.
After all that blah blah and tldr;
Is there not an easier way to swap out the text direction dynamically? If this is a DOM issue, how can I reload the DOM after the asynchronous callback?
I have been at this issue for hours now and have had very little luck on the interwebz.
Any and all help is welcome and greatly appreciated.
Kind Regards,
William Francis
EDIT:
After much investigation I found that the only way to truly work the Arabic way is with a post-back. Once the language has been selected you do a postback, then its just a simple process of changing the Stylesheet HREF attribute from code behind. There doesn't seem to be any form of JavaScript or jQuery that can change it without a post-back and still reflect the new Stylesheet. NOTE: you need to set the Stylesheet HREF on each post-back, i.e. through a master page. The Stylsheet changes do not persist across pages.
Here's a website that helped greatly and explains a whole lot on Stylesheet changes using JavaScript. sadly, it didn't work for me.
http://www.alistapart.com/articles/alternate/
There could be several things going on. I found this page to be very helpful when I was dealing with a similar thing, so I highly recommend it:
http://www.w3.org/International/tutorials/bidi-xhtml/
Also, if you aren't already doing so, use a tool like Firebug to examine the generated DOM after your AJAX has run to be sure you are seeing the altered state of the DOM and not the initial source of the page. It is possible to change the dir dynamically--you can use Firebug to add a new attribute to the HTML tag of this very page (set dir="rtl") to see it change dynamically. It could be some other element is overriding the direction, it could be that the AJAX changes aren't loading correctly, or other things. If you can post more of your code it would be helpful to give a better answer, but I hope this will help.
I am trying to add a rich text editor in my web page where users can write reviews and format what they have written...something similar to the editor in which we write our posts on this site...
can anyone point me to the right direction regarding this...any tutorial that would help me build such a component...
Also i want a free product....(Forgot to mention earlier...)
Something in the likes of TinyMCE or FCKeditor, perhaps.
They're quite complete, and customisable.
The editor used on Stack Overflow is the WMD Editor.
The current version used on the site has been updated by Jeff Attwood and other site users and you can read about it here and get a copy of the code for your own site.
I think you'd be better off using (and perhaps modifying) an existing component rather than writing your own from scratch.
I've been using the Telerik r.a.d Editor, and been very happy with it.
after much research here is what i did...
i needed a control that was free and easy to use..all the editors that i went through came with a licence so i decided to make my own control!!!!
well..i couldnt do that on my own so i used the help of a few sites....
javascript Rich Text Editors
http://aspalliance.com/1092_Rich_Text_Editor_Part_I
http://ws.aspalliance.com/1092_Rich_Text_Editor_Part_II and a few others too...
so the best option for me was to build my own control so that i could customize it according to my needs....
http://freetextbox.com/
here is yet another one: NicEdit