Sha256: 0fd692211282261d3ae258469fcc23d93c7b894c2fc3f84e3ed485f82a2e7f75
Contents?: true
Size: 1.7 KB
Versions: 4
Compression:
Stored size: 1.7 KB
Contents
/* * Aloha Editor * Author & Copyright (c) 2010 Gentics Software GmbH * aloha-sales@gentics.com * Licensed unter the terms of http://www.aloha-editor.com/license.html */ define( ['aloha', 'aloha/jquery', 'aloha/plugin', 'aloha/floatingmenu', 'i18n!horizontalruler/nls/i18n', 'i18n!aloha/nls/i18n', 'css!horizontalruler/css/horizontalruler.css'], function(Aloha, jQuery, Plugin, FloatingMenu, i18n, i18nCore) { var GENTICS = window.GENTICS; return Plugin.create('horizontalruler', { _constructor: function(){ this._super('horizontalruler'); }, languages: ['en'], config: ['hr'], init: function() { var that = this; this.insertButton = new Aloha.ui.Button({ 'name': 'hr', 'iconClass': 'aloha-button-horizontalruler', 'size': 'small', 'onclick': function(element, event) { that.insertHR(); }, 'tooltip': i18n.t('button.addhr.tooltip'), 'toggle': false }); FloatingMenu.addButton( 'Aloha.continuoustext', this.insertButton, i18nCore.t('floatingmenu.tab.insert'), 1 ); Aloha.bind( 'aloha-editable-activated', function ( event, rangeObject ) { if (Aloha.activeEditable) { that.cfg = that.getEditableConfig( Aloha.activeEditable.obj ); if ( jQuery.inArray( 'hr', that.cfg ) != -1 ) { that.insertButton.show(); } else { that.insertButton.hide(); return; } } }); }, insertHR: function(character) { var self = this; var range = Aloha.Selection.getRangeObject(); if(Aloha.activeEditable) { var hr = jQuery('<hr>'); GENTICS.Utils.Dom.insertIntoDOM( hr, range, jQuery(Aloha.activeEditable.obj), true ); range.select(); } } }); });
Version data entries
4 entries across 4 versions & 2 rubygems