Fixes the full screen button in code editor

This commit is contained in:
Samuel Georges 2015-09-25 06:01:59 +10:00
parent 7aea60f11d
commit beca2dddc2
4 changed files with 45 additions and 40 deletions

View File

@ -4267,10 +4267,6 @@ if(this.isFullscreen){$('body').css({overflow:'hidden'})}
else{$('body').css({overflow:'inherit'})} else{$('body').css({overflow:'inherit'})}
this.editor.resize() this.editor.resize()
this.editor.focus()} this.editor.focus()}
+function(exports){if(exports.ace&&typeof exports.ace.require=='function'){var emmetExt=exports.ace.require('ace/ext/emmet')
if(emmetExt&&emmetExt.AceEmmetEditor&&emmetExt.AceEmmetEditor.prototype.getSyntax){var coreGetSyntax=emmetExt.AceEmmetEditor.prototype.getSyntax
emmetExt.AceEmmetEditor.prototype.getSyntax=function(){var $syntax=$.proxy(coreGetSyntax,this)()
return $syntax=='twig'?'html':$syntax};}}}(window)
var old=$.fn.codeEditor var old=$.fn.codeEditor
$.fn.codeEditor=function(option){var args=Array.prototype.slice.call(arguments,1),result $.fn.codeEditor=function(option){var args=Array.prototype.slice.call(arguments,1),result
this.each(function(){var $this=$(this) this.each(function(){var $this=$(this)
@ -4287,4 +4283,7 @@ $.oc={}
$.oc.codeEditorExtensionModes={'htm':'html','html':'html','md':'markdown','txt':'plain_text','js':'javascript','less':'less','scss':'scss','sass':'sass','css':'css'} $.oc.codeEditorExtensionModes={'htm':'html','html':'html','md':'markdown','txt':'plain_text','js':'javascript','less':'less','scss':'scss','sass':'sass','css':'css'}
$.fn.codeEditor.noConflict=function(){$.fn.codeEditor=old $.fn.codeEditor.noConflict=function(){$.fn.codeEditor=old
return this} return this}
$(document).render(function(){$('[data-control="codeeditor"]').codeEditor()})}(window.jQuery); $(document).render(function(){$('[data-control="codeeditor"]').codeEditor()});+function(exports){if(exports.ace&&typeof exports.ace.require=='function'){var emmetExt=exports.ace.require('ace/ext/emmet')
if(emmetExt&&emmetExt.AceEmmetEditor&&emmetExt.AceEmmetEditor.prototype.getSyntax){var coreGetSyntax=emmetExt.AceEmmetEditor.prototype.getSyntax
emmetExt.AceEmmetEditor.prototype.getSyntax=function(){var $syntax=$.proxy(coreGetSyntax,this)()
return $syntax=='twig'?'html':$syntax};}}}(window)}(window.jQuery);

View File

@ -338,24 +338,6 @@
this.editor.focus() this.editor.focus()
} }
// FIX EMMET HTML WHEN SYNTAX IS TWIG
// ==================================
+function (exports) {
if (exports.ace && typeof exports.ace.require == 'function') {
var emmetExt = exports.ace.require('ace/ext/emmet')
if (emmetExt && emmetExt.AceEmmetEditor && emmetExt.AceEmmetEditor.prototype.getSyntax) {
var coreGetSyntax = emmetExt.AceEmmetEditor.prototype.getSyntax
emmetExt.AceEmmetEditor.prototype.getSyntax = function () {
var $syntax = $.proxy(coreGetSyntax, this)()
return $syntax == 'twig' ? 'html' : $syntax
};
}
}
}(window)
// CODEEDITOR PLUGIN DEFINITION // CODEEDITOR PLUGIN DEFINITION
// ============================ // ============================
@ -407,6 +389,24 @@
// =============== // ===============
$(document).render(function () { $(document).render(function () {
$('[data-control="codeeditor"]').codeEditor() $('[data-control="codeeditor"]').codeEditor()
}) });
// FIX EMMET HTML WHEN SYNTAX IS TWIG
// ==================================
+function (exports) {
if (exports.ace && typeof exports.ace.require == 'function') {
var emmetExt = exports.ace.require('ace/ext/emmet')
if (emmetExt && emmetExt.AceEmmetEditor && emmetExt.AceEmmetEditor.prototype.getSyntax) {
var coreGetSyntax = emmetExt.AceEmmetEditor.prototype.getSyntax
emmetExt.AceEmmetEditor.prototype.getSyntax = function () {
var $syntax = $.proxy(coreGetSyntax, this)()
return $syntax == 'twig' ? 'html' : $syntax
};
}
}
}(window)
}(window.jQuery); }(window.jQuery);

View File

@ -294,14 +294,14 @@
var self = this, var self = this,
params = { params = {
duration: 300, duration: 300,
queue: false, queue: false,
complete: function(){ complete: function(){
self.fixScrollClasses() self.fixScrollClasses()
if (callback !== undefined) if (callback !== undefined)
callback() callback()
}
} }
}
params = $.extend(params, options || {}) params = $.extend(params, options || {})
@ -314,20 +314,23 @@
if (offset < 0) { if (offset < 0) {
this.el.animate({'scrollLeft': $el.get(0).offsetLeft}, params) this.el.animate({'scrollLeft': $el.get(0).offsetLeft}, params)
animated = true animated = true
} else { }
else {
offset = $el.get(0).offsetLeft + $el.width() - (this.el.scrollLeft() + this.el.width()) offset = $el.get(0).offsetLeft + $el.width() - (this.el.scrollLeft() + this.el.width())
if (offset > 0) { if (offset > 0) {
this.el.animate({'scrollLeft': $el.get(0).offsetLeft + $el.width() - this.el.width()}, params) this.el.animate({'scrollLeft': $el.get(0).offsetLeft + $el.width() - this.el.width()}, params)
animated = true animated = true
} }
} }
} else { }
else {
offset = $el.get(0).offsetTop - this.el.scrollTop() offset = $el.get(0).offsetTop - this.el.scrollTop()
if (offset < 0) { if (offset < 0) {
this.el.animate({'scrollTop': $el.get(0).offsetTop}, params) this.el.animate({'scrollTop': $el.get(0).offsetTop}, params)
animated = true animated = true
} else { }
else {
offset = $el.get(0).offsetTop - (this.el.scrollTop() + this.el.height()) offset = $el.get(0).offsetTop - (this.el.scrollTop() + this.el.height())
if (offset > 0) { if (offset > 0) {
this.el.animate({'scrollTop': $el.get(0).offsetTop + $el.height() - this.el.height()}, params) this.el.animate({'scrollTop': $el.get(0).offsetTop + $el.height() - this.el.height()}, params)
@ -336,8 +339,9 @@
} }
} }
if (!animated && callback !== undefined) if (!animated && callback !== undefined) {
callback() callback()
}
} }
DragScroll.prototype.dispose = function() { DragScroll.prototype.dispose = function() {

View File

@ -1540,15 +1540,17 @@ params=$.extend(params,options||{})
var offset=0,animated=false var offset=0,animated=false
if(!this.options.vertical){offset=$el.get(0).offsetLeft-this.el.scrollLeft() if(!this.options.vertical){offset=$el.get(0).offsetLeft-this.el.scrollLeft()
if(offset<0){this.el.animate({'scrollLeft':$el.get(0).offsetLeft},params) if(offset<0){this.el.animate({'scrollLeft':$el.get(0).offsetLeft},params)
animated=true}else{offset=$el.get(0).offsetLeft+$el.width()-(this.el.scrollLeft()+this.el.width()) animated=true}
else{offset=$el.get(0).offsetLeft+$el.width()-(this.el.scrollLeft()+this.el.width())
if(offset>0){this.el.animate({'scrollLeft':$el.get(0).offsetLeft+$el.width()-this.el.width()},params) if(offset>0){this.el.animate({'scrollLeft':$el.get(0).offsetLeft+$el.width()-this.el.width()},params)
animated=true}}}else{offset=$el.get(0).offsetTop-this.el.scrollTop() animated=true}}}
else{offset=$el.get(0).offsetTop-this.el.scrollTop()
if(offset<0){this.el.animate({'scrollTop':$el.get(0).offsetTop},params) if(offset<0){this.el.animate({'scrollTop':$el.get(0).offsetTop},params)
animated=true}else{offset=$el.get(0).offsetTop-(this.el.scrollTop()+this.el.height()) animated=true}
else{offset=$el.get(0).offsetTop-(this.el.scrollTop()+this.el.height())
if(offset>0){this.el.animate({'scrollTop':$el.get(0).offsetTop+$el.height()-this.el.height()},params) if(offset>0){this.el.animate({'scrollTop':$el.get(0).offsetTop+$el.height()-this.el.height()},params)
animated=true}}} animated=true}}}
if(!animated&&callback!==undefined) if(!animated&&callback!==undefined){callback()}}
callback()}
DragScroll.prototype.dispose=function(){this.scrollClassContainer=null DragScroll.prototype.dispose=function(){this.scrollClassContainer=null
$(document).off('ready',this.proxy(this.fixScrollClasses)) $(document).off('ready',this.proxy(this.fixScrollClasses))
$(window).off('resize',this.proxy(this.fixScrollClasses)) $(window).off('resize',this.proxy(this.fixScrollClasses))