wysiwyg

How to get number of rows in ContentEditable area and current caret line position?

心不动则不痛 提交于 2020-01-10 03:58:10
问题 my question has two parts, but they are related. Firstly - I have Contenteditable DIV with some text and I need to get total number of rows (lines) of this DIV. Is it possible ? Secondly - I need to get caret row position, if it is on row number 1, 2, 3, etc.... Can anybody help ? 回答1: The direct answer is that there is no method that actually gets you those numbers. However, there are a number of different work arounds which you can apply to estimate (I use estimate , because I don't think

Make django-wysiwyg work on django pages

故事扮演 提交于 2020-01-05 08:35:27
问题 I have a TextField for description on one of my forms, and i want to apply reich text editor for that so tried to use this package, but i am unable to make it work below are my settings settings.py INSTALLED_APPS = ( ..... ..... # Description Rich text editor settings 'tinymce', 'django_wysiwyg', ) DJANGO_WYSIWYG_FLAVOR = "tinymce" template.html {% extends "base.html" %} {% load wysiwyg %} {% wysiwyg_setup %} <form enctype="multipart/form-data" action="{% url 'product_create' %}" method="post

Froala add custom pre code button

纵然是瞬间 提交于 2020-01-05 06:07:07
问题 I'm trying to create a code button with the Froala editor which can basicly do the same thing as here on SO by pressing CNTRL+K . Now I think I have two choices. The first one is to edit the froala-editor.js file, because Froala already has a 'code' button which only adds the <pre> tags. If I could somehow get it to also add the <code> tag, problem solved. Unfortunately I didn't get this to work. The second option is to create a custom button, so far I have this piece of code: $('textarea

How to get current html element(tag) in JTextPane?

微笑、不失礼 提交于 2020-01-05 04:33:33
问题 I am doing on WYSIWYG Html Editor using Java Program. I need When I click mouse on Paragraph element, It should be displays tag in JOption dialog. Please advice me How can i do this? 回答1: See for example this one http://java-sl.com/JEditorPaneStructureTool.html In simple words you can get your HTMLDocument and get paragraph using getParagraphElement() method. Use viewToModel() method of JEditorPane to get caret offet for the clicked point. 来源: https://stackoverflow.com/questions/10533940/how

WYSIWIG with Unicode

ぐ巨炮叔叔 提交于 2020-01-04 06:55:21
问题 I've written a Windows program in Delphi that places and wraps text very precisely to both the screen and printer using GetCharWidth and Em-Square. This has worked well with ANSI text where you only need to retrieve and calculate the widths of 255 characters but when you go to Unicode with 65535 characters its too slow. The problem is made worse by having to create 2 arrays of width, one for normal and one for bold. //Setup a reference canvas for measuring purposes RefDC := CreateCompatibleDC

Inserting tags (WYSIWYG JavaScript editor)

纵然是瞬间 提交于 2020-01-03 04:14:10
问题 I'm currently working on a WYSIWYG editor for a client (It's not like any other editor, it will also be able to insert drawings using HTML5) And I've been looking at and using several ways to insert content. Ok, so I have a div with contentEditable set to "true", and I'm stuck on a way make the text a different size/font by inserting tags before and after to cursor, or something similar. I've tried using Design Mode with execcommand, but that didn't work. Can somebody help? 回答1: You have some

Javascript: Workaround needed: Internet Explorer changes link text when changing the href

半城伤御伤魂 提交于 2020-01-02 04:19:05
问题 I have a problem as follows: We're using a rich text editor (TinyMCE, but that's not important here, I think) in our application. Now, with Internet Explorer 8, we've noticed that if you type in content that looks like a web address: www.google.com ...IE helpfully converts it to a link by some native-to-browser functionality. Now if you really want to make it into a link, and choose to edit link properties, and set the href e.g. to www.google.com/analytics ...then when the javascript sets the

Implement a WYSIWYG document editor in WPF?

混江龙づ霸主 提交于 2020-01-01 18:17:08
问题 How will you approach to implement a WYSIWYG document editor in WPF? This editor is going to be very similar to WYSIWYG html editors, but back-end data structures do not have to be html. Currently, I have a working version based on mshtml control implemented in c++ (this is pretty much like MS InfoPath). I'm seeking to take out the mshtml dependency from this tool, so using WPF WebBrowser control is a choice I want to avoid. Basic features to support: Flow style document Supports a basic set

Extend height to include absolutely positioned children

拟墨画扇 提交于 2019-12-30 01:12:06
问题 I'm building an html/javascript theme designer for a CMS. Elements are positioned absolutely and can be moved/resized via the mouse, and/or contain editable text whose height may be determined by the number of lines. However I'm running into the problem where a parent element's height does not expand to include its absolutely positioned children. Minimal code (also on JSFiddle here): <style> div.layer { position: absolute } div.layer1 { width: 400px; border: 1px solid #ccc } div.layer2 { top:

Data loss when passing raw HTML from View to Controller in POST request — XSS-safety & information loss

不羁岁月 提交于 2019-12-29 09:36:13
问题 Preamble My use-case includes a front-end WYSIWYG editor. Taking user input in HTML5/CSS format from the CSHTML Front-End View. Receiving the input in the Backend Controller's action via POST request. And finally doing fancy Database stuff with it. Sounds pretty easy. Using this beast of an editor, it's very straightforward and customizable. View WYSIWYG editor textarea nested within a form to send editor's raw HTML data using POST <form class="form" asp-controller="CreationController" asp