Permalink
Browse files

Merged gentics:stable into alohaeditor:master

  • Loading branch information...
2 parents e7d72a2 + c300b89 commit 3c0b93af897187cc570d1c9ea92e912b44170b6e @Jotschi Jotschi committed Jul 22, 2011
Showing with 4,247 additions and 901 deletions.
  1. +3 −0 .gitignore
  2. +3 −0 .gitmodules
  3. +23 −0 WebContent/core/core.js
  4. +60 −10 WebContent/core/editable.js
  5. +1 −0 WebContent/core/ext-alohareader.js
  6. +122 −31 WebContent/core/floatingmenu.js
  7. +4 −2 WebContent/core/include.js
  8. +8 −8 WebContent/core/jquery.aloha.js
  9. +54 −29 WebContent/core/markup.js
  10. +22 −10 WebContent/core/plugin.js
  11. +2,961 −0 WebContent/core/rangy-core.js
  12. +128 −24 WebContent/core/repository.js
  13. +80 −8 WebContent/core/repositorymanager.js
  14. +81 −4 WebContent/core/repositoryobjects.js
  15. +1 −1 WebContent/core/ribbon.js
  16. +2 −2 WebContent/core/selection.js
  17. +87 −26 WebContent/core/ui-attributefield.js
  18. +26 −3 WebContent/core/ui.js
  19. +24 −2 WebContent/css/aloha.css
  20. +67 −654 WebContent/deps/prettyPhoto/jquery.prettyPhoto.js
  21. +59 −45 WebContent/examples/AlohaTextarea.php
  22. +17 −3 WebContent/examples/AlohaWorld.css
  23. +101 −5 WebContent/examples/AlohaWorld.html
  24. +1 −0 WebContent/plugins/com.gentics.aloha.plugins.CropNResize
  25. +1 −1 WebContent/plugins/com.gentics.aloha.plugins.Format
  26. +1 −0 WebContent/plugins/com.gentics.aloha.plugins.GCN
  27. +1 −1 WebContent/plugins/com.gentics.aloha.plugins.Link
  28. +1 −1 WebContent/plugins/com.gentics.aloha.plugins.Paste
  29. +1 −1 WebContent/plugins/com.gentics.aloha.plugins.Table
  30. +100 −17 WebContent/utils/dom.js
  31. +3 −1 WebContent/utils/position.js
  32. +85 −6 WebContent/utils/range.js
  33. +1 −1 build/aloha-includes.txt
  34. +1 −1 build/build.properties
  35. +1 −0 build/deps-includes.txt
  36. +3 −2 build/doc/aloha-api.xml
  37. +93 −0 pom.xml
  38. +17 −0 src/main/assembly/package.xml
  39. +3 −2 test/testloader.html
View
@@ -2,5 +2,8 @@
.settings
.gitmodules
build/out
+target
build/api-docs-out
.DS_Store
+/setalohabase.js
+WebContent/plugins/com.gentics.aloha.plugins.GCN/
View
@@ -31,3 +31,6 @@
[submodule "WebContent/plugins/com.gentics.aloha.plugins.Paste"]
path = WebContent/plugins/com.gentics.aloha.plugins.Paste
url = https://github.com/alohaeditor/Aloha-Plugin-Paste.git
+[submodule "WebContent/plugins/com.gentics.aloha.plugins.CropNResize"]
+ path = WebContent/plugins/com.gentics.aloha.plugins.CropNResize
+ url = https://github.com/alohaeditor/Aloha-Plugin-CropNResize.git
View
@@ -253,6 +253,11 @@ GENTICS.Aloha.prototype.deactivateEditable = function () {
*/
GENTICS.Aloha.prototype.getEditableById = function (id) {
+ // if the element is a textarea than route to the editable div
+ if (jQuery('#'+id).get(0).nodeName.toLowerCase() == 'textarea' ) {
+ id = id + '-aloha';
+ }
+
// serach all editables for id
for (var i = 0; i < GENTICS.Aloha.editables.length; i++) {
if (GENTICS.Aloha.editables[i].getId() == id) {
@@ -264,6 +269,20 @@ GENTICS.Aloha.prototype.getEditableById = function (id) {
};
/**
+ * Checks wheater an object is a registered Aloha Editable.
+ * @param {jQuery} obj the jQuery object to be checked.
+ * @return {boolean}
+ */
+GENTICS.Aloha.prototype.isEditable = function (obj) {
+ for (var i=0; i<this.editables.length; i++) {
+ if ( this.editables[i].originalObj.get(0) === obj ) {
+ return true;
+ }
+ }
+ return false;
+};
+
+/**
* Logs a message to the console
* @param level Level of the log ("error", "warn" or "info", "debug")
* @param component Component that calls the log
@@ -475,7 +494,11 @@ GENTICS.Aloha.prototype.loadI18nFile = function(fileUrl, component) {
GENTICS.Aloha.prototype.parseI18nFile = function(data, component) {
data = data.replace(/\r/g, '');
var entries = data.split('\n');
+<<<<<<< HEAD
var dictionary = {};
+=======
+ var dictionary = this.dictionaries[component.toString()] || new Object();
+>>>>>>> c300b8990b1c69307817951b6e18bbc31264e169
for (var i = 0; i < entries.length; ++i) {
var entry = entries[i];
var equal = entry.indexOf('=');
@@ -25,14 +25,15 @@
* @param {Object} obj jQuery object reference to the object
*/
GENTICS.Aloha.Editable = function(obj) {
-
+
// check wheter the object has an ID otherwise generate and set globally unique ID
if ( !obj.attr('id') ) {
obj.attr('id', GENTICS.Utils.guid());
}
// store object reference
this.obj = obj;
+ this.originalObj = obj;
// the editable is not yet ready
this.ready = false;
@@ -71,6 +72,8 @@ GENTICS.Aloha.Editable.prototype.range = undefined;
*/
GENTICS.Aloha.Editable.prototype.check = function() {
+ var that = this;
+
/* TODO check those elements
'map', 'meter', 'object', 'output', 'progress', 'samp',
'time', 'area', 'datalist', 'figure', 'kbd', 'keygen',
@@ -105,14 +108,17 @@ GENTICS.Aloha.Editable.prototype.check = function() {
case 'textarea':
// Create a div alongside the textarea
- var div = jQuery('<div/>').insertAfter(obj);
+ var div = jQuery('<div id="'+this.getId()+'-aloha" class="GENTICS_textarea"/>').insertAfter(obj);
+ // Risize the div to the textarea
+ div.height(obj.height());
+ div.width(obj.width());
// Populate the div with the value of the textarea
div.html(obj.val());
// Hide the textarea
obj.hide();
// Attach a onsubmit to the form to place the HTML of the div back into the textarea
var updateFunction = function(){
- var val = div.html();
+ var val = that.getContents();
obj.val(val);
};
obj.parents('form:first').submit(updateFunction);
@@ -159,12 +165,11 @@ GENTICS.Aloha.Editable.prototype.init = function() {
// add focus event to the object to activate
this.obj.mousedown(function(e) {
- that.activate(e);
- e.stopPropagation();
+ return that.activate(e);
});
this.obj.focus(function(e) {
- that.activate(e);
+ return that.activate(e);
});
// by catching the keydown we can prevent the browser from doing its own thing
@@ -214,14 +219,35 @@ GENTICS.Aloha.Editable.prototype.init = function() {
/**
* destroy the editable
* @return void
- * @hide
*/
GENTICS.Aloha.Editable.prototype.destroy = function() {
var that = this;
// leave the element just to get sure
this.blur();
+ // original Object
+ var oo = this.originalObj.get(0),
+ onn = oo.nodeName.toLowerCase();
+
+ // special handled elements
+ switch ( onn ) {
+ case 'label':
+ case 'button':
+ // TODO need some special handling.
+ break;
+
+ case 'textarea':
+ // restore content to original textarea
+ var val = this.getContents();
+ this.originalObj.val(val);
+ this.obj.remove();
+ this.originalObj.show();
+
+ default:
+ break;
+ }
+
// now the editable is not ready any more
this.ready = false;
@@ -244,6 +270,13 @@ GENTICS.Aloha.Editable.prototype.destroy = function() {
});
*/
+ // also hide the floating menu if the current editable was active
+ if (this.isActive) {
+ GENTICS.Aloha.FloatingMenu.obj.hide();
+ GENTICS.Aloha.FloatingMenu.shadow.hide();
+ }
+
+
// throw a new event when the editable has been created
/**
* @event editableCreated fires after a new editable has been destroyes, eg. via $('#editme').mahalo()
@@ -325,14 +358,28 @@ GENTICS.Aloha.Editable.prototype.enable = function() {
* @method
*/
GENTICS.Aloha.Editable.prototype.activate = function(e) {
+ // stop event propagation for nested editables
+ if (e) {
+ e.stopPropagation();
+ }
+
+ // get active Editable before setting the new one.
+ var oldActive = GENTICS.Aloha.getActiveEditable();
+
+ // handle special case in which a nested editable is focused by a click
+ // in this case the "focus" event would be triggered on the parent element
+ // which actually shifts the focus away to it's parent. this if is here to
+ // prevent this situation
+ if (e && e.type == "focus" && oldActive != null && oldActive.obj.parent().get(0) == e.currentTarget) {
+ return;
+ }
// leave immediately if this is already the active editable
if (this.isActive || this.isDisabled()) {
+ // we don't want parent editables to be triggered as well, so return false
return;
}
- // get active Editable before setting the new one.
- var oldActive = GENTICS.Aloha.getActiveEditable();
// set active Editable in core
GENTICS.Aloha.activateEditable( this );
@@ -372,7 +419,6 @@ GENTICS.Aloha.Editable.prototype.activate = function(e) {
'oldActive' : GENTICS.Aloha.getActiveEditable()
})
);
-
};
/**
@@ -432,6 +478,10 @@ GENTICS.Aloha.Editable.prototype.empty = function(str) {
GENTICS.Aloha.Editable.prototype.getContents = function() {
// clone the object
var clonedObj = this.obj.clone(true);
+
+ // do core cleanup
+ clonedObj.find('.GENTICS_cleanme').remove();
+
GENTICS.Aloha.PluginRegistry.makeClean(clonedObj);
return clonedObj.html();
};
@@ -28,6 +28,7 @@ Ext.data.AlohaObjectReader = function(meta, recordType) {
'name',
'type',
'weight',
+ 'path',
'repositoryId'
]
});
Oops, something went wrong.

0 comments on commit 3c0b93a

Please sign in to comment.