I'm not stuck on the keybinding or aesthetics of this, please change
them at will. All I really want is the ability to display a menu where I
can change the editor's settings from and I want the menu to be smart
enough to automatically know about new settings. This pretty much works
except there isn't a registry for themes and modes so every new theme or
mode has to be added to the internal list by hand...
Is this the right way to use the static highlighter with the
noconflict build?
Edit as necessary. This is about as good as I can get it...
loads modules from script tags
makes div visible after highlighting
fixes display (sort of)
codeEl margin & padding 0
editor overflow auto, gutter position relative
replace code element with div
mode can be specified as a string
mode and theme may be specified as strings
This preserves the behavior of this method when specifying mode and
theme as objects. It adds the ability to specify mode and theme as
module paths. When specifying mode and / or theme as a module path you
must provide a callback function. The callback function will receive the
same value as the return value previously returned when specifying mode
and theme as objects.
Good stuff.
multiple elements with different modes and themes
The example shows multiple elements highlighted with different modes and
themes all in the same page. The pre element isn't ideal.
The example shows how to transfer the computed width and height of the
element into its inline style so that it won't dramatically change shape
and disrupt the page once it's had highlighting applied. It would
probably be better to replace the elements entirely and apply sizing
styles to the replacement elements but that isn't always an option.