Enabled focusing (and thereby pasting into) non-sealed templated containers.

This commit is contained in:
Daniel Stolt
2015-10-03 19:26:13 +02:00
parent 6995f26fd5
commit bd96bf9895
26 changed files with 12298 additions and 33 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./jquery.fileupload"],e):e(window.jQuery)}(function(e){"use strict";var s=e.blueimp.fileupload.prototype.options.add;e.widget("blueimp.fileupload",e.blueimp.fileupload,{options:{processQueue:[],add:function(r,i){var o=e(this);i.process(function(){return o.fileupload("process",i)}),s.call(this,r,i)}},processActions:{},_processFile:function(s,r){var i=this,o=e.Deferred().resolveWith(i,[s]),t=o.promise();return this._trigger("process",null,s),e.each(s.processQueue,function(s,o){var n=function(s){return r.errorThrown?e.Deferred().rejectWith(i,[r]).promise():i.processActions[o.action].call(i,s,o)};t=t.pipe(n,o.always&&n)}),t.done(function(){i._trigger("processdone",null,s),i._trigger("processalways",null,s)}).fail(function(){i._trigger("processfail",null,s),i._trigger("processalways",null,s)}),t},_transformProcessQueue:function(s){var r=[];e.each(s.processQueue,function(){var i={},o=this.action,t=this.prefix===!0?o:this.prefix;e.each(this,function(r,o){i[r]="string"===e.type(o)&&"@"===o.charAt(0)?s[o.slice(1)||(t?t+r.charAt(0).toUpperCase()+r.slice(1):r)]:o}),r.push(i)}),s.processQueue=r},processing:function(){return this._processing},process:function(s){var r=this,i=e.extend({},this.options,s);return i.processQueue&&i.processQueue.length&&(this._transformProcessQueue(i),0===this._processing&&this._trigger("processstart"),e.each(s.files,function(o){var t=o?e.extend({},i):i,n=function(){return s.errorThrown?e.Deferred().rejectWith(r,[s]).promise():r._processFile(t,s)};t.index=o,r._processing+=1,r._processingQueue=r._processingQueue.pipe(n,n).always(function(){r._processing-=1,0===r._processing&&r._trigger("processstop")})})),this._processingQueue},_create:function(){this._super(),this._processing=0,this._processingQueue=e.Deferred().resolveWith(this).promise()}})});
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./jquery.fileupload-process"],e):e(window.jQuery)}(function(e){"use strict";e.blueimp.fileupload.prototype.options.processQueue.push({action:"validate",always:!0,acceptFileTypes:"@",maxFileSize:"@",minFileSize:"@",maxNumberOfFiles:"@",disabled:"@disableValidation"}),e.widget("blueimp.fileupload",e.blueimp.fileupload,{options:{getNumberOfFiles:e.noop,messages:{maxNumberOfFiles:"Maximum number of files exceeded",acceptFileTypes:"File type not allowed",maxFileSize:"File is too large",minFileSize:"File is too small"}},processActions:{validate:function(i,l){if(l.disabled)return i;var r,s=e.Deferred(),t=this.options,o=i.files[i.index];return(l.minFileSize||l.maxFileSize)&&(r=o.size),"number"===e.type(l.maxNumberOfFiles)&&(t.getNumberOfFiles()||0)+i.files.length>l.maxNumberOfFiles?o.error=t.i18n("maxNumberOfFiles"):!l.acceptFileTypes||l.acceptFileTypes.test(o.type)||l.acceptFileTypes.test(o.name)?r>l.maxFileSize?o.error=t.i18n("maxFileSize"):"number"===e.type(r)&&r<l.minFileSize?o.error=t.i18n("minFileSize"):delete o.error:o.error=t.i18n("acceptFileTypes"),o.error||i.files.error?(i.files.error=!0,s.rejectWith(this,[i])):s.resolveWith(this,[i]),s.promise()}}})});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -39,6 +39,8 @@
};
this.canSplit = function () {
if (this.isTemplated)
return false;
return this.width > 1;
};
@@ -63,34 +65,50 @@
};
this.canContractRight = function (connectAdjacent) {
if (this.isTemplated)
return false;
return this.parent.canContractColumnRight(this, connectAdjacent);
};
this.contractRight = function (connectAdjacent) {
if (!this.canContractRight())
return;
this.parent.contractColumnRight(this, connectAdjacent);
};
this.canExpandRight = function (connectAdjacent) {
if (this.isTemplated)
return false;
return this.parent.canExpandColumnRight(this, connectAdjacent);
};
this.expandRight = function (connectAdjacent) {
if (!this.canExpandRight())
return;
this.parent.expandColumnRight(this, connectAdjacent);
};
this.canExpandLeft = function (connectAdjacent) {
if (this.isTemplated)
return false;
return this.parent.canExpandColumnLeft(this, connectAdjacent);
};
this.expandLeft = function (connectAdjacent) {
if (!this.canExpandLeft())
return;
this.parent.expandColumnLeft(this, connectAdjacent);
};
this.canContractLeft = function (connectAdjacent) {
if (this.isTemplated)
return false;
return this.parent.canContractColumnLeft(this, connectAdjacent);
};
this.contractLeft = function (connectAdjacent) {
if (!this.canContractLeft())
return;
this.parent.contractColumnLeft(this, connectAdjacent);
};
@@ -27,6 +27,13 @@
});
};
var _baseSetIsFocused = this.setIsFocused;
this.setIsFocused = function () {
if (this.getIsSealed())
return;
_baseSetIsFocused.call(this);
};
this.addChild = function (child) {
if (!_(this.children).contains(child) && (_(this.allowedChildTypes).contains(child.type) || child.isContainable))
this.children.push(child);
@@ -75,7 +75,7 @@
this.setIsFocused = function () {
if (!this.editor)
return;
if (this.isTemplated)
if (!this.children && this.isTemplated)
return;
if (this.editor.isDragging || this.editor.inlineEditingIsActive || this.editor.isResizing)
return;
@@ -120,34 +120,39 @@
};
this.canDelete = function () {
return !!this.parent;
if (this.isTemplated || !this.parent)
return false;
return true;
};
this.delete = function () {
if (!!this.parent)
this.parent.deleteChild(this);
if (!this.canDelete())
return;
this.parent.deleteChild(this);
};
this.canMoveUp = function () {
if (!this.parent)
if (this.isTemplated || !this.parent)
return false;
return this.parent.canMoveChildUp(this);
};
this.moveUp = function () {
if (!!this.parent)
this.parent.moveChildUp(this);
if (!this.canMoveUp())
return;
this.parent.moveChildUp(this);
};
this.canMoveDown = function () {
if (!this.parent)
if (this.isTemplated || !this.parent)
return false;
return this.parent.canMoveChildDown(this);
};
this.moveDown = function () {
if (!!this.parent)
this.parent.moveChildDown(this);
if (!this.canMoveDown())
return;
this.parent.moveChildDown(this);
};
this.elementToObject = function () {
@@ -176,8 +181,10 @@
};
this.cut = function (clipboardData) {
this.copy(clipboardData);
this.delete();
if (this.canDelete()) {
this.copy(clipboardData);
this.delete();
}
};
this.paste = function (clipboardData) {
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -12,7 +12,7 @@
<ul class="layout-panel layout-panel-main">
<li class="layout-panel-item layout-panel-label">Column ({{element.width}})</li>
@Display(New.LayoutEditor_Template_Properties(ElementTypeName: "column", Items: additionalItems))
<li class="layout-panel-item layout-panel-action" title="@T("Delete column (Del)")" ng-click="delete(element)"><i class="fa fa-remove"></i></li>
<li class="layout-panel-item layout-panel-action" title="@T("Delete column (Del)")" ng-click="delete(element)" ng-class="{disabled: !element.canDelete()}"><i class="fa fa-remove"></i></li>
<li class="layout-panel-item layout-panel-action" title="@T("Move column left (Ctrl+Left)")" ng-click="element.moveUp()" ng-class="{disabled: !element.canMoveUp()}"><i class="fa fa-chevron-left"></i></li>
<li class="layout-panel-item layout-panel-action" title="@T("Move column right (Ctrl+Right)")" ng-click="element.moveDown()" ng-class="{disabled: !element.canMoveDown()}"><i class="fa fa-chevron-right"></i></li>
<li class="layout-panel-item layout-panel-action" title="@T("Split column")" ng-click="element.split()" ng-class="{disabled: !element.canSplit()}"><i class="fa fa-columns"></i></li>
@@ -3,7 +3,7 @@
<li class="layout-panel-item layout-panel-label">{{::element.contentTypeLabel}}</li>
<li class="layout-panel-item layout-panel-action layout-panel-action-edit" ng-show="{{element.hasEditor}}" title="Edit {{element.contentTypeLabel.toLowerCase()}} content (Enter)" ng-click="edit()"><i class="fa fa-code"></i></li>
@Display(New.LayoutEditor_Template_Properties(ElementTypeName: "{{element.contentTypeLabel.toLowerCase()}}"))
<li class="layout-panel-item layout-panel-action" title="@T("Delete {{element.contentTypeLabel.toLowerCase()}} (Del)")" ng-click="delete(element)"><i class="fa fa-remove"></i></li>
<li class="layout-panel-item layout-panel-action" title="@T("Delete {{element.contentTypeLabel.toLowerCase()}} (Del)")" ng-click="delete(element)" ng-class="{disabled: !element.canDelete()}"><i class="fa fa-remove"></i></li>
<li class="layout-panel-item layout-panel-action" title="@T("Move {{element.contentTypeLabel.toLowerCase()}} up (Ctrl+Up)")" ng-click="element.moveUp()" ng-class="{disabled: !element.canMoveUp()}"><i class="fa fa-chevron-up"></i></li>
<li class="layout-panel-item layout-panel-action" title="@T("Move {{element.contentTypeLabel.toLowerCase()}} down (Ctrl+Down)")" ng-click="element.moveDown()" ng-class="{disabled: !element.canMoveDown()}"><i class="fa fa-chevron-down"></i></li>
</ul>
@@ -3,7 +3,7 @@
<li class="layout-panel-item layout-panel-label">{{::element.contentTypeLabel}}</li>
<li class="layout-panel-item layout-panel-action layout-panel-action-edit" ng-show="{{element.hasEditor}}" title="Edit {{element.contentTypeLabel.toLowerCase()}} content (Enter)" ng-click="edit()"><i class="fa fa-code"></i></li>
@Display(New.LayoutEditor_Template_Properties(ElementTypeName: "{{element.contentTypeLabel.toLowerCase()}}"))
<li class="layout-panel-item layout-panel-action" title="@T("Delete {{element.contentTypeLabel.toLowerCase()}} (Del)")" ng-click="delete(element)"><i class="fa fa-remove"></i></li>
<li class="layout-panel-item layout-panel-action" title="@T("Delete {{element.contentTypeLabel.toLowerCase()}} (Del)")" ng-click="delete(element)" ng-class="{disabled: !element.canDelete()}"><i class="fa fa-remove"></i></li>
<li class="layout-panel-item layout-panel-action" title="@T("Move {{element.contentTypeLabel.toLowerCase()}} up (Ctrl+Up)")" ng-click="element.moveUp()" ng-class="{disabled: !element.canMoveUp()}"><i class="fa fa-chevron-up"></i></li>
<li class="layout-panel-item layout-panel-action" title="@T("Move {{element.contentTypeLabel.toLowerCase()}} down (Ctrl+Down)")" ng-click="element.moveDown()" ng-class="{disabled: !element.canMoveDown()}"><i class="fa fa-chevron-down"></i></li>
</ul>
@@ -1,5 +1,5 @@
@using Orchard.Layouts.ViewModels
<li class="layout-panel-item layout-panel-action layout-panel-action-properties layout-popup-trigger" title="@T("Edit {0} properties (Space)", Model.ElementTypeName)">
<li class="layout-panel-item layout-panel-action layout-panel-action-properties layout-popup-trigger" title="@T("Edit {0} properties (Space)", Model.ElementTypeName)" ng-show="{{!element.isTemplated}}">
<i class="fa fa-edit"></i>
<ul class="layout-popup layout-popup-edit" orc-layout-popup>
<li class="layout-popup-item layout-popup-input">
@@ -2,7 +2,7 @@
<ul class="layout-panel layout-panel-main">
<li class="layout-panel-item layout-panel-label">Row</li>
@Display(New.LayoutEditor_Template_Properties(ElementTypeName: "row"))
<li class="layout-panel-item layout-panel-action" title="@T("Delete row (Del)")" ng-click="delete(element)">
<li class="layout-panel-item layout-panel-action" title="@T("Delete row (Del)")" ng-click="delete(element)" ng-class="{disabled: !element.canDelete()}">
<i class="fa fa-remove"></i>
</li>
<li class="layout-panel-item layout-panel-action" title="@T("Move row up (Ctrl+Up)")" ng-click="element.moveUp()" ng-class="{disabled: !element.canMoveUp()}">