Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed firefox selection bugs

  • Loading branch information...
commit 3a3512f2c1175cd8db8858227520fe37e7f0aabd 1 parent d27e7d7
@johnny authored
Showing with 63 additions and 43 deletions.
  1. +37 −30 TODO
  2. +25 −12 source/javascripts/modes/wysiwygMode.js
  3. +1 −1  source/layout.haml
View
67 TODO
@@ -1,11 +1,45 @@
-* [33/41] Further improvements
- - [-] wysiwyg
- - [ ] Firefox: fix checkState for one bold word
+* [34/42] Further improvements
+ - [-] split up markupEditor.js
+ - [X] look how ender handles the extensability
+ perhaps (... ME.Mode = Mode;})(ME, jQuery) is an option
+ - [ ] split it up
+ - [ ] spec closing of editors
+ - [ ] should work with external select
+ - [ ] better editor loading
+ - [ ] handle multiple init gracefully. Currently it stacks two editors on top of each other
+ - [ ] loading from textarea with an unknown mode, that is inside a textarea, should work
+ - [ ] flexible toolbar, which stays on top
+ - [ ] wysiwyg
+ - [ ] checkIfDeleteAll should work with holding a neutral key combined with a destructive action
+ shift + letter for example
- [ ] br tags should be top level, because Border expects that
or alternatively change behavior of the node search within Border
This would be the approach with a future since there might be other
cases of nested nodes ( b>i, i>b would be different now, but should
be the same)
+ - [ ] spec with selenium
+ - [ ] spec press enter
+ - [ ] in list
+ - [ ] pressing enter on empty list item should remove the list item and add a paragraph
+ - [ ] in heading
+ - [ ] spec press shift enter
+ - [ ] in list
+ - [ ] spec press entf
+ - [ ] between lists
+ - [ ] between blocks
+ - [ ] spec backspace
+ - [ ] between lists
+ - [ ] between blocks
+ - [ ] spec double click
+ - [ ] double click on bold word should select just the bold tag
+ - [ ] show window in different awesome tab
+ - [ ] use existing window (not supported in ruby bindings)
+ - [ ] fire native events (not supported in awesome, try in kde or windows)
+ - [ ] clean and parse pasted html
+ - [ ] handle blocktags within lists
+ - [X] wysiwyg
+ - [X] Firefox: fix checkState for one bold word
+ - [X] Firefox: keycombos delete selection
- [X] expand selection to word boundaries, just as in textile
- [X] pressing enter on empty list item should remove the list item and add a paragraph
@@ -28,33 +62,6 @@
- [X] enter in the middle of a heading does not move the rest of the heading down
- [X] selecting all by hand and deleting it leaves empty tags
this is a result of the current implementation of checkIfDeletedAll
- - [ ] split up markupEditor.js
- - [ ] look how ender handles the extensability
- perhaps (... ME.Mode = Mode;})(ME, jQuery) is an option
- - [ ] spec closing of editors
- - [ ] should work with external select
- - [ ] better editor loading
- - [ ] handle multiple init gracefully. Currently it stacks two editors on top of each other
- - [ ] loading from textarea with an unknown mode, that is inside a textarea, should work
- - [ ] flexible toolbar, which stays on top
- - [ ] spec with selenium
- - [ ] spec press enter
- - [ ] in list
- - [ ] pressing enter on empty list item should remove the list item and add a paragraph
- - [ ] in heading
- - [ ] spec press shift enter
- - [ ] in list
- - [ ] spec press entf
- - [ ] between lists
- - [ ] between blocks
- - [ ] spec backspace
- - [ ] between lists
- - [ ] between blocks
- - [ ] show window in different awesome tab
- - [ ] use existing window (not supported in ruby bindings)
- - [ ] fire native events (not supported in awesome, try in kde or windows)
- - [ ] clean and parse pasted html
- - [ ] handle blocktags within lists
- [X] Improve dialog
- [X] merge tipsy and isValid
- [X] Better Dialogs (for inspiration see gollum)
View
37 source/javascripts/modes/wysiwygMode.js
@@ -221,26 +221,37 @@
* arrow keys
*/
function checkCaret(adjustment){
- var range = selection.getRangeAt(0),node, text;
+ var node, text,
+ range = selection.getRangeAt(0),
+ rangeIsCollapsed = range.collapsed;
+
function checkSibling(property, collapse){
while(!node[property]){
node = node.parentNode;
}
node = node[property];
if(node && !/br|h\d|p/i.test(node.nodeName)){
- selectNodes([node], collapse);
+ if(rangeIsCollapsed){
+ selectNodes([node], collapse);
+ } else { // Fix a Firefox bug: double click on a bold word
+ // overextends the start of the selection outside the bold tag
+ if(collapse){
+ range.setStartBefore(node.firstChild);
+ }
+ selection.removeAllRanges();
+ selection.addRange(range);
+ }
return false;
}
}
- if(range.collapsed){
- node = range.startContainer;
- if(node.nodeType == 3){ // Its a textnode
- text = node.nodeValue;
- if(range.startOffset + adjustment === 0 && /^ /.test(text)){
- return checkSibling('previousSibling', false);
- } else if(range.startOffset + adjustment === node.length && / $/.test(text)){
- return checkSibling('nextSibling', true);
- }
+
+ node = range.startContainer;
+ if(node.nodeType == 3){ // Its a textnode
+ text = node.nodeValue;
+ if(range.startOffset + adjustment === 0 && /^ /.test(text)){
+ return checkSibling('previousSibling', false);
+ } else if(range.startOffset + adjustment === node.length && / $/.test(text)){
+ return checkSibling('nextSibling', true);
}
}
}
@@ -800,6 +811,8 @@
return {};
}
+ checkCaret(0);
+
function getParents(node, content){
// TODO document me! why is this here?
if(content){
@@ -857,7 +870,7 @@
case 39: // right arrow
return checkCaret(1);
default:
- return checkIfDeletedAll(editor.preview, keyCode, this.holdNeutralKey);
+ return checkIfDeletedAll(editor.preview, keyCode, ME.holdNeutralKey);
}
},
/**
View
2  source/layout.haml
@@ -14,7 +14,7 @@
= yield
- = javascript_include_tag "vendor/jquery", "vendor/jquery-ui", 'vendor/jquery.tipsy'
+ = javascript_include_tag "vendor/jquery", "vendor/jquery-ui"
= javascript_include_tag 'init', "plugins/t10n", 'locale/en', "plugins/isValid.js", "markupEditor", "util"
= javascript_include_tag "plugins/combobox", "plugins/enhanceTextfield", "dialog"
= javascript_include_tag "modes/textile/textileMode", "modes/textile/bruteForceCompiler"
Please sign in to comment.
Something went wrong with that request. Please try again.