PATH:
home
/
letacommog
/
letaweb
/
admin
/
modules
/
text
define(['module/base'],function(base) { return createModuleDefinition([base], function($q,$window,$dialog,pageEdit_constanst,pageEdit_ddManager,pageEdit_function,pageEdit_layout,lazyLoadWidget,pageEdit_modules,pageEdit_event) { this.moduleInfoButtons= { 'move':true, 'plus':true, 'moveup':false, 'movedown':false, 'edit':false, 'delete':true, 'clone':true, }; this.is_floatable = true; this.initializeData = { text:'Try to keep things short and to the point. People like to scan pages on facebook so make it easy for them. Remember, this text is your potential customer’s first point of contact, so make it count' }; this.controller = function($scope) { }; this.insert = function(dropInfo) { var insert_point = dropInfo.node; var pos = dropInfo.direction; var insertPlacement = this.createInsertPlacement(insert_point, pos, dropInfo); this.element = insertPlacement; var defered = $q.defer(); var e = this.insertText(); this.loadElement(insertPlacement); defered.resolve(e); return defered.promise; }; this.insertText = function() { var element = this.getElement(); element = jQuery(element); var data = this.initializeData; var wrapper = jQuery('<div class="wrapper"/>'); element.append(wrapper); var text = jQuery('<div class="text"/>'); wrapper.append(text); text.html(this.initializeData.text); }; this.openEditor = function() { }; this.floatModule = function(element, floatDir) { element = jQuery(element); var t = this.getElement(); if(floatDir === "right") { element.addClass(pageEdit_layout.column_float_right_class); } else { element.addClass(pageEdit_layout.column_float_left_class); } element.addClass(pageEdit_layout.column_class + 6); jQuery(t).before(element); //PageEdit.layout.add_float_column(row, inserted); pageEdit_event.fire(pageEdit_event.BLOCK_MOVED,{'block':element}); pageEdit_event.fire(pageEdit_event.COLUMN_ADDED,{'block':element}); }; this.setContent = function(e) { var t = this.getElement(); var text = jQuery('.text', t); text.html(e); }; this.getData = function() { var t = this.getElement(); var text = jQuery('.text', t); return {text:text.html()}; }; this.insertModule = function(insert_point, pos, element, floating, floatDir) { var t = this.getElement(); var text = jQuery('.text', t); var b = ""; var a = ""; var f = false; var is_first = jQuery(insert_point).is(":first-child"); var is_last = jQuery(insert_point).is(":last-child"); if(!floating) { text.children().each(function(e) { if($(this).is(insert_point)) { f = true; return; } if(!f) b += this.outerHTML; else a += this.outerHTML; if(pos == "top") { a = insert_point[0].outerHTML + a; } else b += insert_point[0].outerHTML; }); text.html(b); var dropInfo = { node:this.getElement(), direction:'bottom', shouldFloat:false, }; var module_id = pageEdit_function.generateModuleId(t); dropInfo.element_identifier = module_id; var type = this.type; lazyLoadWidget(type).then(function(moduleDefinition) { var module = pageEdit_function.createModuleInstance(moduleDefinition, type); if(!module) return; pageEdit_modules.modules[module_id] = module; module.insert(dropInfo).then(function() { module.setContent(a); module.moveBlock(t,'bottom', element); }); }); } else { this.floatModule(element, floatDir); } }; this.handleDragEventdfdfd = function(event, ui) { var t = jQuery(this.getElement()); if(pageEdit_ddManager.isFloatingModule(t)) return; var wrapper = t.children('.wrapper'); var module_split_droppable_selector = pageEdit_constanst.module_split_droppable_selector; var text = wrapper.children('.text'); var dropped = false; /*jQuery(module_split_droppable_selector, text).each(function(index, element) { dropped = pageEdit_ddManager.inDragHandlerRegion(this); if(dropped) { pageEdit_ddManager.handleInnerOver(event, this,ui ); } });*/ if(!dropped) this._handleDragEvent(event, ui); }; this._bindEvent = function() { var that = this; var element = this.getElement(); jQuery(element).unbind(); jQuery(element).bind('mouseover', function(event) { if($window.module_editing) return; if($window.dragging) return; //event.stopPropagation(); that.hover(); }); jQuery(element).bind('dblclick', function(event) { if($window.module_editing) return; if($window.dragging) return; event.stopPropagation(); }); jQuery(element).bind('click', function(event) { if($window.module_editing && !$window.text_editing) return; that.initEditor(); }); jQuery(element).bind('mouseleave', function(event) { if($window.module_editing) return; if($window.dragging) return; //event.stopPropagation(); that.unhover(); }); this.select(); }; this._copyDataTo = function(new_element) { var instance = pageEdit_layout.createCloneModule(new_element, this.getElement()); delete instance.inlineEditor; } this.initEditor = function() { if(this.inlineEditor != undefined) return; var t = jQuery(this.getElement()); var text = this.getElement().children('.wrapper').children('.text').attr('contenteditable', 'true'); var options = { toolbar: 'full', toolbar_full: [ //jshint ignore:line { name: 'basicstyles',items: [ 'Bold', 'Italic', 'Strike', 'Underline' ] }, { name: 'paragraph', items: [ 'BulletedList', 'NumberedList', 'Outdent', 'Indent' ] }, { name: 'editing', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] }, { name: 'links', items: [ 'Link', 'Unlink' ] }, '/', { name: 'styles', items: [ 'Format', 'FontSize', 'PaletteTextColor', 'RemoveFormat' ] }, { name: 'clipboard', items: [ 'Undo', 'Redo','RemoveBlock' ] }, ], disableNativeSpellChecker: true, uiColor: '#FAFAFA', height: '400px', width: '100%' }; var b = pageEdit_event.iframe.getDocument(); b = (b.defaultView || b.parentWindow); try { var that = this; this.inlineEditor = b.CKEDITOR.inline( text[0], options); this.inlineEditor.on('focus', function() { that.removeModuleInfo(); $window.module_editing = true; $window.text_editing = true; }); this.inlineEditor.on('instanceReady', function() { that.inlineEditor.focus(); }); this.inlineEditor.on('blur', function() { delete $window.module_editing; delete $window.text_editing; that.unhover(); }); var that = this; this.inlineEditor.on('removeBlock', function() { $dialog.confirm({ templateUrl: getRelativeUrl() + 'moduleExecute?path=content&action=getHtml&name=modules/extra/deleteWidget', }).result.then(function() { that.inlineEditor.destroy(); // delete ($window.module_editing) delete ($window.dragging) that.delete(); }); }); } catch(e) { console.log(this.getElement()); } } // this.createModuleInfo = function(){} this.select = function() { //this.initEditor(); } }); });
[+]
..
[-] backend.php
[edit]
[-] backend.js
[edit]
[-] frontend_class.php
[edit]
[-] frontend_view.php
[edit]