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

Add the Froala WYSIWYG Editor #863

Merged
merged 14 commits into from
Oct 21, 2015
Merged

Conversation

jrjohnson
Copy link
Member

This seems to be our only choice for a relatively modern toolbar based editor which plays nicely with ember.

Before this is merged it needs to be added to and tested on:

  • Edit objective title
  • New objective title
  • Session Description
  • Learning material description
  • Learning material notes
  • Fix lists in rendered output
  • fix lists inside editor

Fixes #458

@jrjohnson jrjohnson deployed to ilios-frontend-demo-pr-863 October 7, 2015 04:56 Active
@jrjohnson
Copy link
Member Author

@saschaben can you enumerate all of the places this editor should be displayed?

@saschaben / @dartajax please test the editing of a course objective title to get a feel for this thing and see if it will work for us. A heroku build should be available shortly to make it easy to try out.

@saschaben
Copy link
Member

Editor needs to be in place for:

Program objective (add new and edit)
Course objective (add new and edit)
Session objective (add new and edit)
Session description (add new and edit)
Learning material description (add new and edit)
Learning material notes (add new and edit)

@saschaben
Copy link
Member

Hmm. Looks like it may be a little buggy. delimited lists don't work -- it adds an unnecessary UL tag which breaks them; ordered lists don't work and I can't tell why.

Also: we will need to modify the UI display so that we are rendering any formatting in both edit AND non-edit modes, otherwise we run the high risk of making most entries with any real level of formatting unintelligible.

@saschaben
Copy link
Member

Attempting to edit/update a session objective throws an error destroying the objective; also attempting to show html code on same has the same impact. Only occurring on session, not course.

errilios 2015-10-07 11-07-06

@jrjohnson
Copy link
Member Author

Yes, please just test on course objective. The other editors may or may not appear, but I haven't hooked them up.

@saschaben
Copy link
Member

multiple edits causes course objective to be cleared:

err2

you can see this behavior with a simple test of open the editor, cancel, open the editor, save, re-open the editor, save. the objective will revert to null with a "click to edit" default value displayed.

@saschaben
Copy link
Member

"Show HTML" is blank after cut& paste from word.

@jrjohnson jrjohnson closed this Oct 15, 2015
@jrjohnson jrjohnson reopened this Oct 15, 2015
@jrjohnson
Copy link
Member Author

@saschaben please test again - you will need to runnomless to get the latest version of everything. The only remaining bug I see is that clicking the show HTML button causes a black screen. This only happens if you have not focused the cursor into the editor window before clicking the button. I tried several pastes from word and all appeared to render correctly.
I didn't know what:

delimited lists don't work -- it adds an unnecessary UL

meant as I wasn't able to get an extra UL tag to show up anywhere.

@jrjohnson jrjohnson deployed to ilios-frontend-demo-pr-863 October 15, 2015 05:38 Active
The editor component does not yet pass actions back correctly so we
have to use query to get the value out before we save.
New version of ember-froala allows for better binding of actions.
Added to course and session objective list titles and the session
overview.
In order to make this work effectively I changed the pattern we were
using for adding new objectives.  Now only a single objective can be
created.  Using the +/- control.
By default out lists have no style, this resets them closer to the
browser default style.
@jrjohnson
Copy link
Member Author

This is ready for review

@jrjohnson
Copy link
Member Author

I lied, not quite ready, needs some translations.

@jrjohnson jrjohnson assigned jrjohnson and unassigned stopfstedt Oct 16, 2015
@jrjohnson jrjohnson assigned stopfstedt and unassigned jrjohnson Oct 16, 2015
@jrjohnson
Copy link
Member Author

OK, now we're ready for review. All translations in.

//strip any possible HTML out of the text
return text.replace(/(<([^>]+)>)/ig,"");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems kinda hinky.
why not use jQuery here: http://api.jquery.com/text/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never occured to me actually. Good change

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stopfstedt jquery.text() is for working with elements. We're working with a string passed from somewhere else like the DB. This would lead to something like:
return Ember.$("<div/>").html(text).text(); I'm not sure that isn't more confusing. This isn't a security step, its purely to easy in the display. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, forgot that you'll actually have to wrap your string in markup first.
that is more confusing.
let's go with your initial solution for now.

@stopfstedt
Copy link
Member

👍

stopfstedt added a commit that referenced this pull request Oct 21, 2015
@stopfstedt stopfstedt merged commit 18d5d45 into ilios:master Oct 21, 2015
@jrjohnson jrjohnson deleted the 458-froalaeditor branch November 10, 2015 17:37
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.

Add WYSIWYG editor option to inplace-textarea / big-text components
3 participants