Howling Mad – Aloha Editor Sneak Peek – Functional WYSIWIG



Howling Mad – Aloha Editor Sneak Peek – Functional WYSIWIG

1 0


howling-mad-viennajs

Aloha Editor Howling Mad presentation for Vienna JS on 28th of May 2014

On Github cprerovsky / howling-mad-viennajs

Howling Mad

Aloha Editor Sneak Peek

Clemens Prerovsky@blacktarmac

Heavy Lifters

Functional WYSIWIG

The importance of being stateless

Editor Stack

The editor stack contains all the functions passed for each browser event.

aloha.editor.stack = [
  Selections.handle,
  Typing.handle,
  Blocks.handle,
  DragDrop.handle,
  Paste.handle,
  function (alohaEvent) {
    alohaEvent.editable = alohaEvent.editor.editables[1];
    return alohaEvent;
  },
  Mouse.handle,
  Keys.handle
];

Aloha Editor handles EVERYTHING

  • caret placement & display
  • inserting characters
  • inserting node like <p> and <br />
  • no more browser code cleanup
  • no more external libraries

Integrating Aloha Editor

Integration of Aloha Editor into your application is a matter of

loading aloha.js :)

aloha()-fying editable nodes

aloha(document.querySelector('.aloha-editable'));

and tapping into the editor stack

aloha.editor.stack.unshift(function myHandler(alohaEvent) {
	// your magic goes here
});

Boundaries

Ranges vs. Selections vs. Boundaries

Ranges in different* Browsers

This is  important!

This is <b><em>important!</em></b>
This is []<b><em>important!</em></b>
This is <b><em>[]important!</em></b>
* guess who effed up badly...

Boundaries to the Rescue!

We tried...

Boromir

Aloha Editor Boromir

Milestones 2014

  • June: dogfooding phase
  • Sept: official release

Cheers!

made with http://lab.hakim.se/reveal-js/#/