Skip to content

Commit

Permalink
Item12583:Item12619:
Browse files Browse the repository at this point in the history
   * revert $VERSION to simple floats
   * working around IE10 incompatibility to its own proprietary edit api for textareas


git-svn-id: http://svn.foswiki.org/trunk@17021 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Nov 1, 2013
1 parent 3678822 commit 67cc498
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
1 change: 1 addition & 0 deletions NatEditPlugin/data/System/NatEditPlugin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ is sufficient.
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | |
| 01 Nov 2013 | working around IE10 incompatibility of its own proprietary edit api for textareas |
| 07 Aug 2013 | fixed generation of a new validation key in a save+continue |
| 17 Jul 2013 | added support for <nop>CaptchaPlugin |
| 18 Jun 2013 | removed dependency on <nop>SetVariablePlugin |
Expand Down
5 changes: 2 additions & 3 deletions NatEditPlugin/lib/Foswiki/Plugins/NatEditPlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ use Foswiki::Func ();
use Foswiki::Plugins ();
use Foswiki::Validation ();

# Simple decimal version, use parse method, no leading "v"
use version; our $VERSION = version->parse("7.10");
our $RELEASE = '07 Aug 2013';
our $VERSION = '7.11';
our $RELEASE = '7.11';
our $NO_PREFS_IN_TOPIC = 1;
our $SHORTDESCRIPTION = 'A Wikiwyg Editor';
our $baseWeb;
Expand Down
12 changes: 5 additions & 7 deletions NatEditPlugin/pub/System/NatEditPlugin/edit.uncompressed.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function handleKeyDown () { }
for (key in rules) {
if (1) {
val = rules[key];
$.log("EDIT: setting #"+key+"_"+type+"="+val);
//$.log("EDIT: setting #"+key+"_"+type+"="+val);
$("#"+key+"_"+type).val(val);
}
}
Expand All @@ -51,7 +51,7 @@ function handleKeyDown () { }
}
});
names = names.join(', ');
$.log("EDIT: switchOnDetails - names="+names);
//$.log("EDIT: switchOnDetails - names="+names);
setPermission(type, {
allow: names
});
Expand All @@ -66,7 +66,7 @@ function handleKeyDown () { }

function setPermissionSet(permSet) {
var wikiName = foswiki.getPreference("WIKINAME");
$.log("EDIT: called setPermissionSet "+permSet);
//$.log("EDIT: called setPermissionSet "+permSet);
switch(permSet) {
/* change rules */
case 'default_change':
Expand Down Expand Up @@ -172,9 +172,7 @@ function handleKeyDown () { }
$editForm.find("input[name='action_cancel']").val('');
$editForm.find("input[name='action_"+editAction+"']").val(actionValue);

if (typeof(foswikiStrikeOne) != 'undefined') {
foswikiStrikeOne($editForm[0]);
}
StrikeOne.submit($editForm[0]);

if ((typeof(tinyMCE) === 'object') && (typeof(tinyMCE.editors) === 'object')) {
$.each(tinyMCE.editors, function(index, editor) {
Expand Down Expand Up @@ -396,7 +394,7 @@ function handleKeyDown () { }
onSelect: function(input) {
var currentValues = input.currentValues,
type = (input.opts.inputName=="Local+PERMSET_CHANGE_DETAILS")?"change":"view";
$.log("EDIT: currentValues="+currentValues);
//$.log("EDIT: currentValues="+currentValues);
setPermission(type, {
allow: currentValues.join(", ")
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ $.NatEditor = function(txtarea, opts) {
self.opts.showWysiwyg = true;
}

if (typeof(self.txtarea.selectionStart) === 'undefined') {
self.oldIE = true; /* all IEs up to IE9; IE10 has got selectionStart/selectionEnd */
}

// dont do both: disable autoMaxExpand if we autoExpand
if (self.opts.autoExpand) {
Expand Down Expand Up @@ -140,7 +143,6 @@ $.NatEditor.prototype.handleLineFeed = function(ev) {

prevLine = text.substring(startPos, endPos);


if (ev.shiftKey) {
if (prevLine.match(/^((?: )+)(\*|\d+| ) /)) {
list = RegExp.$1+" ";
Expand Down Expand Up @@ -168,13 +170,14 @@ $.NatEditor.prototype.handleLineFeed = function(ev) {
prefix = text.substr(0, endPos);
postfix = text.substr(endPos);

if (document.selection && !$.browser.opera) { // IE
if (self.oldIE) {
list = "\r\n" + list;
} else {
list = "\n" + list;
}
}


self.txtarea.value = prefix + list + postfix;
self.setCaretPosition(prefix.length + list.length);

Expand Down Expand Up @@ -546,7 +549,7 @@ $.NatEditor.prototype.getSelectionRange = function() {

//$.log("called getSelectionRange()");

if (document.selection && !$.browser.opera) { // IE
if (self.oldIE) {
$(self.txtarea).focus();

text = self.txtarea.value;
Expand All @@ -557,6 +560,7 @@ $.NatEditor.prototype.getSelectionRange = function() {
rangeCopy.moveToElementText(self.txtarea);
range.text = c;
pos = (rangeCopy.text.indexOf(c));


range.moveStart("character", -1);
range.text = selection;
Expand All @@ -565,7 +569,7 @@ $.NatEditor.prototype.getSelectionRange = function() {
pos = text.length;
selection = "";
}

self.txtarea.selectionStart = pos;

if (selection == "") {
Expand Down Expand Up @@ -1004,7 +1008,7 @@ $.NatEditor.prototype.autoExpand = function() {
window.setTimeout(function() {
text = self.txtarea.value+'x';
if (text == self._lastText) {
$.log("suppressing events");
//$.log("suppressing events");
return;
}
self._lastText = text;
Expand Down
2 changes: 1 addition & 1 deletion NatEditPlugin/templates/edit.natedit.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<input type="hidden" name="templatetopic" value="%TEMPLATETOPIC%" />
<input type="hidden" name="template" value="%URLPARAM{"template"}%" />%TMPL:END%

%TMPL:DEF{"textarea"}%<textarea id="topic" class="foswikiTextarea foswikiWysiwygEdit natEditTextArea natedit {autoMaxExpand:true, minHeight:215 %TMPL:P{"natedit::options"}%}" name="text" rows="22" cols="70">%TEXT%</textarea>%TMPL:END%
%TMPL:DEF{"textarea"}%<textarea id="topic" class="foswikiTextarea foswikiWysiwygEdit natEditTextArea natedit {autoMaxExpand:true, minHeight:215, %TMPL:P{"natedit::options"}%}" name="text" rows="22" cols="70">%TEXT%</textarea>%TMPL:END%
%TMPL:DEF{"messages"}%<div id="natEditMessageContainer"></div>%TMPL:END%

%TMPL:DEF{"formend"}%<input type="hidden" name="forcenewrevision" value="%URLPARAM{"forcenewrevision"}%" />
Expand Down
2 changes: 1 addition & 1 deletion NatEditPlugin/templates/form.natedit.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

%TMPL:DEF{"repeatedformrows"}% %REPEAT%
<tr>
<th>%ROWTITLE%%ROWEXTRA%:</th>
<th>%ROWTITLE%%ROWEXTRA%</th>
<td>%ROWVALUE%</td>
</tr>%REPEAT%
<tr>
Expand Down

0 comments on commit 67cc498

Please sign in to comment.