-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes.txt
106 lines (98 loc) · 5.81 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
== Research on execCommand() users ==
vBulletin (http://www.vbulletin.com/forum/clientscript/vbulletin_textedit.js):
* Link given now actually goes to a copy of CKEditor, since they realized
rolling their own editor wasn't a good idea. This applies more to older
versions.
* Lots and lots and lots of browser sniffing. Only appears to support IE,
Firefox, Opera.
* Forces CSS mode off: if (is_moz) this.editdoc.execCommand('useCSS', false, true);
* Wraps insertLink to unlink the selection first
* Wraps various commands to insert HTML at the end of the document if
there's no selection, instead of (I guess) doing nothing
* Consistently uses getRangeAt(0) to get the corresponding range, as though it
assumes that's the active range; in fact the affected range will be the last
one, typically, not the first, if there are multiple ranges. Also uses
addRange() as though it will change the selection instead of expanding it.
This combination seems likely to cause some bugs in Firefox. They mostly use
their own add_range() function as a Selection.selectAllChildren() workalike,
but in at least one place they use straight addRange(), probably by mistake.
* Assumes all nodes are either element or text, in at least one place
* Goes to some trouble to do insertImage but then add attributes; maybe this is
worth natively supporting somehow? Something like insertNode? (Or does that
already exist?)
* Constantly calls a function check_focus(), which mostly just does
this.editwin.focus(). This is most likely because some commands fail
gratuitously if the document isn't focused? Need to look into it.
* When doing queryCommandValue('fontname'), special-cases the empty string by
replacing it with this.editdoc.body.style.fontFamily. Similar for fontsize.
* Has an entire function whose description is "Function to translate the output
from queryCommandState('forecolor') into something useful", which handles not
only the empty string and null, but also translates rgb() syntax to #xxxxxx
syntax ("translate_silly_hex()"). This one seems to be used only for setting
id's, though.
* Sets p { margin: 0 } somewhere for the editable document, presumably to
account for IE and Opera.
jwysiwyg (https://github.com/akzhan/jwysiwyg):
* Browser-sniffs "IE" vs. "W3C" by going down standards-compliant code-paths if
(window.getSelection). jwysiwyg++. (Mostly.)
* Assumes window.getSelection evaluates to boolean false if there is no
selection. I'm about 98% sure this is wrong. But it just means the codepath
is always missed, which is harmless.
* Also goes to some lengths to insert an image with attributes. It does
insertImage with a src of "#jwysiwyg#", then effectively does
querySelector("img[src=#jwysiwyg#]") to find it, except it uses a home-made
getElementByAttributeValue method.
* Also assumes getSelection().getRangeAt(0) will always return the current
selection's range.
* Works around lack of insertHTML support in IE by using insertImage, finding
the image as described above, and replacing it with the desired HTML . . .
(uses browser-sniffing instead of feature-detection, bad jwysiwyg).
* Throws in focus() calls for IE. Maybe IE doesn't work right if stuff isn't
focused?
* removeFormat doesn't remove headings, so it optionally removes headings when
its internal formatting thing is called . . . using
execCommand("formatBlock", false, "<p>"). ???
* Has an option to replace <div> with <p>. Wonder how well this works.
* Turns styleWithCSS/useCSS off in Mozilla (although perhaps buggily).
CKEditor (http://ckeditor.com): Spent a while trying to figure it out, gave up.
Way too much abstraction for me to figure out. I'm not sure if they use
execCommand() at all.
TinyMCE (http://tinymce.moxiecode.com/):
* Big, complicated project, unlike vBulletin and jwysiwyg. No way I'll be able
to even skim all of it.
* Always forces styleWithCSS to false
* "Text formatter engine class. This class is used to apply formats like bold,
italic, font size etc to the current selection or specific nodes. This engine
was build to replace the browsers default formatting logic for execCommand
due to it's inconsistant and buggy behavior." Not much more to see here, it
seems.
== List requirements ==
* <ol><li>foo<li>[bar]<li>baz</ol>
* insertOrderedList: <ol><li>foo</ol>bar<ol><li>baz</ol>
* insertUnorderedList: <ol><li>foo</ol><ul><li>bar</ul><ol><li>baz</ol>
* indent: <ol><li>foo<ol><li>bar</ol><li>baz</ol>
* outdent: <ol><li>foo</ol>bar<ol><li>baz</ol>
* <ol><li>foo</ol>[bar]
* insertOrderedList: <ol><li>foo<li>bar</ol>
* <ol><li>[foo]<br>bar<li>baz</ol>
* insertOrderedList: foo<br>bar<ol><li>baz</ol>
* insertUnorderedList: <ul><li>foo<br>bar</ul><ol><li>baz</ol>
* indent: <ol><ol><li>foo<br>bar</ol><li>baz</ol>
* outdent: foo<br>bar<ol><li>baz</ol>
* <ol><li>foo<br>[bar]<li>baz</ol>
* Same behavior as last case.
* <ol><li>foo<ol><li>[bar]<li>baz</ol><li>quz</ol>
* insertOrderedList: <ol><li>foo<li>bar<ol><li>baz</ol><li>quz</ol>
* insertUnorderedList: <ol><li>foo<ul><li>bar</ul><ol><li>baz</ol><li>quz</ol>
* indent: <ol><li>foo<ol><ol><li>bar</ol><li>baz</ol><li>quz</ol>
* outdent: <ol><li>foo<li>bar<ol><li>baz</ol><li>quz</ol>
* <ol><li>foo<ul><li>[bar]<li>baz</ul><li>quz</ol>
* insertOrderedList: <ol><li>foo<ol><li>bar</ol><ul><li>baz</ul><li>quz</ol>
* insertUnorderedList: <ol><li>foo<li>bar<ul><li>baz</ul><li>quz</ol>
* indent: <ol><li>foo<ul><ul><li>bar</ul><li>baz</ul><li>quz</ol>
* outdent: <ol><li>foo<li>bar<ul><li>baz</ul><li>quz</ol>
* <ol><li>foo<li>[bar]<ol><li>baz</ol><li>quz</ol>
* insertOrderedList: <ol><li>foo</ol>bar<ol><ol><li>baz</ol><li>quz</ol>
* insertUnorderedList: <ol><li>foo</ol><ul><li>bar</ul><ol><ol><li>baz</ol><li>quz</ol>
* indent: <ol><li>foo<ol><li>bar<ol><li>baz</ol><li>quz</ol>
* outdent: <ol><li>foo</ol>bar<ol><ol><li>baz</ol><li>quz</ol>