editor icon indicating copy to clipboard operation
editor copied to clipboard

Added to docs: Setting the editor content and refreshing the editor

Open srinathh opened this issue 11 years ago • 5 comments

  • If we need to set the content programmatically instead of picking up from text area, we can use editor.codemirror.setValue(). This is currently not mentioned in the documentation
  • If there are changes in sizes or hiding/unhiding of editor (eg. using the editor in a modal dialog), the editor content does not show correctly. We need to call editor.codemirror.refresh() programmatically after the visibility/sizing is complete to make things look correctly. This is also documented in the CodeMirror API documentation
  • If you are self-hosting the Editor vs. pulling it from the CDN, you additionally need the icon font file if you are using the toolbar. This is not clear in the documentation and added the link.

srinathh avatar Dec 29 '14 02:12 srinathh

@srinathh I've added a shortcut for setting and getting values: https://github.com/lepture/editor/blob/master/src/editor.js#L216

lepture avatar Dec 29 '14 09:12 lepture

@lepture Ok thanks - will use them! However, i still think these shortcuts / commonly used features etc. should be noted in the Readme documentation... else folks have to read through the javascript source to figure out how to use the Editor which is a bit painful for people who don't primarily code in javascript (eg. myself) and just want to use it as a drop-in component with a bit of javascript glue.

The other point on Refresh is something which i encountered yesterday trying to use Editor in a project of mine. I had the editor in a Bootstrap Modal and when the there is any visibility change, unless I do refresh, the contents displayed in the editor is all wrong - so it may be worth calling out.

On Mon Dec 29 2014 at 2:32:39 PM Hsiaoming Yang [email protected] wrote:

@srinathh https://github.com/srinathh I've added a shortcut for setting and getting values: https://github.com/lepture/editor/blob/master/src/editor.js#L216

— Reply to this email directly or view it on GitHub https://github.com/lepture/editor/pull/69#issuecomment-68241591.

srinathh avatar Dec 29 '14 16:12 srinathh

@srinathh Yes, you are absolutely right. I'll sort it out soon.

lepture avatar Dec 30 '14 05:12 lepture

This already helped! Thanks.

firedev avatar Feb 18 '15 03:02 firedev

Thanks!

On Mon, Dec 29, 2014, 2:32 PM Hsiaoming Yang [email protected] wrote:

@srinathh https://github.com/srinathh I've added a shortcut for setting and getting values: https://github.com/lepture/editor/blob/master/src/editor.js#L216

— Reply to this email directly or view it on GitHub https://github.com/lepture/editor/pull/69#issuecomment-68241591.

srinathh avatar Feb 18 '15 05:02 srinathh