Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

srinathh
Copy link

  • 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.

…or. Added link to font file

1. If you are self-hosting the Editor vs. linking to it, you additionally need the icon font file if you are using the toolbar. Added link
2. To set the content programmatically instead of picking up from text area, we can use editor.codemirror.setValue
3. If there are changes in sizes or hiding/unhiding of editor, we need to call editor.codemirror.refresh to make things look correct
@lepture
Copy link
Owner

lepture commented Dec 29, 2014

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

@srinathh
Copy link
Author

@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
#69 (comment).

@lepture
Copy link
Owner

lepture commented Dec 30, 2014

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

@firedev
Copy link

firedev commented Feb 18, 2015

This already helped! Thanks.

@srinathh
Copy link
Author

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
#69 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants