Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Here is my basic plan to implement an optional WYSIWYG editor for posting. The idea is to give monks the option (default: off) of using a graphical JavaScript editor for making new posts. In my opinion, this could be especially helpful in SoPW for inexperienced users.

The idea is to use CKEditor 4 (or rather, a slightly modified version to fit Perl Monks Approved HTML tags). CKEditor 4 is ideal for this, because it just lays on top of the existing HTML textarea field and can be persuaded to update the textarea field whenever the form is posted. It also allows to edit the HTML directly ("View Source" button). Since this is an experimental feature that requires JavaScript, i propose that this overlay will only be active when all of the following conditions are true:

  1. The user has selected HTML as the prefered markup language in user settings
  2. The user has forced preview active in user settings
  3. The user has enabled the "Experimental WYSIWYG" editor in user settings

This would translate to a pseudo-code like this:

# while generating the <head> part if($usersettings[markuptype] eq 'html' && !$usersettings[disable_forced_preview] && $usersettings[graphical_content_editor]) { # external JS file also includes some form of "document.addEventLi +stener("DOMContentLoaded", function(event) {" # to initialize the editor after the browser has finished loading +everything. # This way it should not conflict with content security policy $html .= '<script type="text/javascript" src="/static/ckeditor_per +lmonks.js"></script>'; }

As this editor is completely optional and off by default, nothing should change for users, except if they go into their settings and enable it. Even if it is enabled, if the users browser has JavaScript disabled/blocked, the form would just silently and automatically fall back to the classic "edit HTML by hand" textarea. This is because the Editor doesn't replace the textarea in the HTML form, it just runs on top of it.

perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'

In reply to WYSIWYG editor by cavac

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 23:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found