summaryrefslogtreecommitdiffstats
path: root/infrastructure/ace/www/ace2_inner.js
diff options
context:
space:
mode:
Diffstat (limited to 'infrastructure/ace/www/ace2_inner.js')
-rw-r--r--infrastructure/ace/www/ace2_inner.js45
1 files changed, 42 insertions, 3 deletions
diff --git a/infrastructure/ace/www/ace2_inner.js b/infrastructure/ace/www/ace2_inner.js
index e817c95..33c13e8 100644
--- a/infrastructure/ace/www/ace2_inner.js
+++ b/infrastructure/ace/www/ace2_inner.js
@@ -752,6 +752,12 @@ function OUTER(gscope) {
italic: function() { toggleAttributeOnSelection('italic'); },
underline: function() { toggleAttributeOnSelection('underline'); },
strikethrough: function() { toggleAttributeOnSelection('strikethrough'); },
+ h1: function() { toggleAttributeOnSelection('h1'); },
+ h2: function() { toggleAttributeOnSelection('h2'); },
+ h3: function() { toggleAttributeOnSelection('h3'); },
+ h4: function() { toggleAttributeOnSelection('h4'); },
+ h5: function() { toggleAttributeOnSelection('h5'); },
+ h6: function() { toggleAttributeOnSelection('h6'); },
undo: function() { doUndoRedo('undo'); },
redo: function() { doUndoRedo('redo'); },
clearauthorship: function(prompt) {
@@ -1523,7 +1529,9 @@ function OUTER(gscope) {
}
var STYLE_ATTRIBS = {bold: true, italic: true, underline: true,
- strikethrough: true, list: true};
+ strikethrough: true, h1: true, h2: true,
+ h3: true, h4: true, h5: true, h6: true,
+ list: true};
var OTHER_INCORPED_ATTRIBS = {insertorder: true, author: true};
function isStyleAttribute(aname) {
@@ -2070,8 +2078,34 @@ function OUTER(gscope) {
[[attributeName,'']]);
}
else {
- performDocumentApplyAttributesToRange(rep.selStart, rep.selEnd,
- [[attributeName,'true']]);
+ var settings = [[attributeName, 'true']];
+
+ if (attributeName == 'h1' || attributeName == 'h2' || attributeName == 'h3' ||
+ attributeName == 'h4' || attributeName == 'h5' || attributeName == 'h6') {
+
+ settings = [['h1',''], ['h2',''], ['h3',''],
+ ['h4',''], ['h5',''], ['h6','']];
+ if (attributeName == 'h1') {
+ settings[0] = [attributeName, 'true'];
+ }
+ else if (attributeName == 'h2') {
+ settings[1] = [attributeName, 'true'];
+ }
+ else if (attributeName == 'h3') {
+ settings[2] = [attributeName, 'true'];
+ }
+ else if (attributeName == 'h4') {
+ settings[3] = [attributeName, 'true'];
+ }
+ else if (attributeName == 'h5') {
+ settings[4] = [attributeName, 'true'];
+ }
+ else if (attributeName == 'h6') {
+ settings[5] = [attributeName, 'true'];
+ }
+ }
+
+ performDocumentApplyAttributesToRange(rep.selStart, rep.selEnd, settings);
}
}
@@ -4762,6 +4796,11 @@ function OUTER(gscope) {
a = a.nextSibling;
b = b.nextSibling;
}
+
+ // fix if first line has margin (f.e. h1 in first line)
+ sideDivInner.firstChild.style.marginTop =
+ (doc.body.firstChild.offsetTop - sideDivInner.firstChild.offsetTop +
+ parseInt(sideDivInner.firstChild.style.marginTop + "0")) + "px";
}
}