<div contenteditable="true" class="mixedContainer" style="height: 120px; overflow: auto; font-size: 15px;">
This is my test. <span contenteditable="false" class="field mixed" hidefocus="true" unselectable="true"><span contenteditable="false" fieldid="33"><strong>(</strong><span>customer name</span><a class="fieldOptions"><span class="ui-icon-wrench" /></a><strong>
)</strong></controls></span><input type="hidden" value="false" name="item_27828-line_72573-field_87798-33-bold"></span>
this is more text of my contentEditable div.
</div>
--
You received this message because you are subscribed to the Google Groups "rangy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rangy+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
function moveToValidPosition($container){
var sel,range,startnode,parent;
var sel = rangy.getSelection();
if(sel.rangeCount < 1){
return false;
}
range = sel.getRangeAt(0);
startnode = range.startContainer;
if(startnode === $container) {
return true;
}
while(startnode !== $container){
parent = startnode.parentNode;
if(parent === null){
return false;
}
if(parent.nodeType === 1 && /field/.test(parent.className)){
range.selectNode(parent);
range.collapse(false);
sel.setSingleRange(range);
}
startnode = parent;
}
sel.refresh();
range = sel.getRangeAt(0);
if(range.isCollapsed){
return true;
}
endnode = range.startContainer;
if(endnode === $container){
return true;
}
while(endnode !== $container){
parent = endnode.parentNode;
if(parent === null){
return false;
}
if(parent.nodeType === 1 && /field/.test(parent.className)){
range.selectNode(parent);
range.collapse(true);
sel.setSingleRange(range);
}
endnode = parent;
}
sel.refresh();
return true;
}
<script id="mixedFieldTemplate1" type="text/x-jquery-tmpl">
<span unselectable="true" hidefocus="true" contenteditable="false" class="field mixed" ID="${index}-${fieldID}">
<span contenteditable="false" fieldID="${fieldID}"><controls><strong>(</strong><span class="label" style="font-weight:;font-size:#variables.defaultFontSize.getValue()#px;text-decoration:;font-style:;">${name}</span> <a href="javascript:void(0);" class="fieldOptions" title="Options"><span class="ui-icon ui-icon-wrench ui-icon-inline"></span></a><a href="javascript:void(0);" class="deleteField" title="Delete"><span class="ui-icon ui-icon-close ui-icon-inline"></span></a><strong>)</strong></controls></span>
<input type="hidden" name="${index}-${fieldID}-bold" value="#variables.inline.getBold()#" />
<input type="hidden" name="${index}-${fieldID}-fontSizeID" value="#variables.defaultFontSize.getID()#" />
<input type="hidden" name="${index}-${fieldID}-underline" value="#variables.inline.getUnderline()#" />
<input type="hidden" name="${index}-${fieldID}-italicize" value="#variables.inline.getItalicize()#" />
<input type="hidden" name="${index}-${fieldID}-transformID" value="#variables.defaultTransform.getID()#" />
<input type="hidden" name="${index}-${fieldID}-isDate" value="#variables.inline.getIsDate()#" />
<input type="hidden" name="${index}-${fieldID}-dateFormatID" value="#variables.defaultDateFormat.getID()#" />
</span>
</script>