Html Editor default font

This commit is contained in:
RainLoop Team 2014-08-12 16:32:08 +04:00
parent 2dd9b076fe
commit 6ad84283b7
7 changed files with 172 additions and 160 deletions

View file

@ -69,7 +69,7 @@ NewHtmlEditorWrapper.prototype.resetDirty = function ()
/** /**
* @return {string} * @return {string}
*/ */
NewHtmlEditorWrapper.prototype.getData = function () NewHtmlEditorWrapper.prototype.getData = function (bWrapIsHtml)
{ {
if (this.editor) if (this.editor)
{ {
@ -78,7 +78,9 @@ NewHtmlEditorWrapper.prototype.getData = function ()
return this.editor.__plain.getRawData(); return this.editor.__plain.getRawData();
} }
return this.editor.getData(); return bWrapIsHtml ?
'<div data-html-editor-font-wrapper="true" style="font-family: arial, sans-serif; font-size: 13px;">' +
this.editor.getData() + '</div>' : this.editor.getData();
} }
return ''; return '';
@ -166,7 +168,7 @@ NewHtmlEditorWrapper.prototype.init = function ()
self.editor = window.CKEDITOR.appendTo(self.$element[0], oConfig); self.editor = window.CKEDITOR.appendTo(self.$element[0], oConfig);
self.editor.on('key', function(oEvent) { self.editor.on('key', function(oEvent) {
if (oEvent && oEvent.data && 9 === oEvent.data.keyCode) if (oEvent && oEvent.data && 9 /* Tab */ === oEvent.data.keyCode)
{ {
return false; return false;
} }
@ -177,6 +179,7 @@ NewHtmlEditorWrapper.prototype.init = function ()
}); });
self.editor.on('mode', function() { self.editor.on('mode', function() {
self.blurTrigger(); self.blurTrigger();
if (self.fOnModeChange) if (self.fOnModeChange)

View file

@ -261,7 +261,7 @@ function PopupsComposeViewModel()
this.bcc(), this.bcc(),
this.subject(), this.subject(),
this.oEditor ? this.oEditor.isHtml() : false, this.oEditor ? this.oEditor.isHtml() : false,
this.oEditor ? this.oEditor.getData() : '', this.oEditor ? this.oEditor.getData(true) : '',
this.prepearAttachmentsForSendOrSave(), this.prepearAttachmentsForSendOrSave(),
this.aDraftInfo, this.aDraftInfo,
this.sInReplyTo, this.sInReplyTo,
@ -298,7 +298,7 @@ function PopupsComposeViewModel()
this.bcc(), this.bcc(),
this.subject(), this.subject(),
this.oEditor ? this.oEditor.isHtml() : false, this.oEditor ? this.oEditor.isHtml() : false,
this.oEditor ? this.oEditor.getData() : '', this.oEditor ? this.oEditor.getData(true) : '',
this.prepearAttachmentsForSendOrSave(), this.prepearAttachmentsForSendOrSave(),
this.aDraftInfo, this.aDraftInfo,
this.sInReplyTo, this.sInReplyTo,
@ -668,6 +668,7 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
sDate = '', sDate = '',
sSubject = '', sSubject = '',
oText = null, oText = null,
oSubText = null,
sText = '', sText = '',
sReplyTitle = '', sReplyTitle = '',
aResplyAllParts = [], aResplyAllParts = [],
@ -724,7 +725,9 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
oText = $(oMessage.body).clone(); oText = $(oMessage.body).clone();
Utils.removeBlockquoteSwitcher(oText); Utils.removeBlockquoteSwitcher(oText);
sText = oText.html();
oSubText = oText.find('[data-html-editor-font-wrapper=true]');
sText = oSubText && oSubText[0] ? oSubText.html() : oText.html();
switch (sComposeType) switch (sComposeType)
{ {

View file

@ -4340,7 +4340,7 @@ NewHtmlEditorWrapper.prototype.resetDirty = function ()
/** /**
* @return {string} * @return {string}
*/ */
NewHtmlEditorWrapper.prototype.getData = function () NewHtmlEditorWrapper.prototype.getData = function (bWrapIsHtml)
{ {
if (this.editor) if (this.editor)
{ {
@ -4349,7 +4349,9 @@ NewHtmlEditorWrapper.prototype.getData = function ()
return this.editor.__plain.getRawData(); return this.editor.__plain.getRawData();
} }
return this.editor.getData(); return bWrapIsHtml ?
'<div data-html-editor-font-wrapper="true" style="font-family: arial, sans-serif; font-size: 13px;">' +
this.editor.getData() + '</div>' : this.editor.getData();
} }
return ''; return '';
@ -4437,7 +4439,7 @@ NewHtmlEditorWrapper.prototype.init = function ()
self.editor = window.CKEDITOR.appendTo(self.$element[0], oConfig); self.editor = window.CKEDITOR.appendTo(self.$element[0], oConfig);
self.editor.on('key', function(oEvent) { self.editor.on('key', function(oEvent) {
if (oEvent && oEvent.data && 9 === oEvent.data.keyCode) if (oEvent && oEvent.data && 9 /* Tab */ === oEvent.data.keyCode)
{ {
return false; return false;
} }
@ -4448,6 +4450,7 @@ NewHtmlEditorWrapper.prototype.init = function ()
}); });
self.editor.on('mode', function() { self.editor.on('mode', function() {
self.blurTrigger(); self.blurTrigger();
if (self.fOnModeChange) if (self.fOnModeChange)
@ -9297,7 +9300,7 @@ function PopupsComposeViewModel()
this.bcc(), this.bcc(),
this.subject(), this.subject(),
this.oEditor ? this.oEditor.isHtml() : false, this.oEditor ? this.oEditor.isHtml() : false,
this.oEditor ? this.oEditor.getData() : '', this.oEditor ? this.oEditor.getData(true) : '',
this.prepearAttachmentsForSendOrSave(), this.prepearAttachmentsForSendOrSave(),
this.aDraftInfo, this.aDraftInfo,
this.sInReplyTo, this.sInReplyTo,
@ -9334,7 +9337,7 @@ function PopupsComposeViewModel()
this.bcc(), this.bcc(),
this.subject(), this.subject(),
this.oEditor ? this.oEditor.isHtml() : false, this.oEditor ? this.oEditor.isHtml() : false,
this.oEditor ? this.oEditor.getData() : '', this.oEditor ? this.oEditor.getData(true) : '',
this.prepearAttachmentsForSendOrSave(), this.prepearAttachmentsForSendOrSave(),
this.aDraftInfo, this.aDraftInfo,
this.sInReplyTo, this.sInReplyTo,
@ -9704,6 +9707,7 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
sDate = '', sDate = '',
sSubject = '', sSubject = '',
oText = null, oText = null,
oSubText = null,
sText = '', sText = '',
sReplyTitle = '', sReplyTitle = '',
aResplyAllParts = [], aResplyAllParts = [],
@ -9760,7 +9764,9 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
oText = $(oMessage.body).clone(); oText = $(oMessage.body).clone();
Utils.removeBlockquoteSwitcher(oText); Utils.removeBlockquoteSwitcher(oText);
sText = oText.html();
oSubText = oText.find('[data-html-editor-font-wrapper=true]');
sText = oSubText && oSubText[0] ? oSubText.html() : oText.html();
switch (sComposeType) switch (sComposeType)
{ {

File diff suppressed because one or more lines are too long