PageSourceSearch

https://www.ivecocr.cz/resource/fea/js/tinymce.fea.jquery.js?_dc=126

js ivecocr.cz collected 2026-10-02 05:58:49 UTC 4,584 bytes, 180 lines download raw bytes

1/* -----------------------------------------------------
2 * Vanilla2
3 * (c) A-Websys (http://www.awebsys.cz)
4 * -----------------------------------------------------
5 * $VanillaVersion::  2.5             $   verze Vanilly
6 * $Revision:: 407                    $   revize Vanilly
7 * $Author:: vidensky                 $   autor
8 * $Date:: 2016-04-22 11:06:16 +0200 #$   datum
9 * -----------------------------------------------------
10 */
11jQuery(function($){
12
13	var simpleClass = $.fea.isType('bssimple')
14		? 'bssimple'
15		: 'simple';
16
17	$.fea.registerType('wysiwyg',{
18		extends: 'base',
19		_getCtConfig: function(){
20			return {
21				errors: {
22					selector: '.fea-errors',
23					creator: '<div class="fea-errors help-block">'
24				},
25				editor: {
26					selector: '.js-tiny-content'
27				},
28				input: {
29					selector: '.js-tiny-input',
30					creator: '<input class="js-tiny-input" type="hidden">'
31				}
32			};
33		},
34		_configCache: null,
35		init: function(){
36			var me = this;
37			me._getCt('input').attr('name',me.getName());
38			me._callParent('base','init',arguments);
39
40			if ( !me.active && me.mode === 'editoronly')
41			{
42				this._getCt('editor').hide();
43			}
44		},
45
46		getValue: function() {
47			var value = this._getCt('editor').html();
48			this._getCt('input').val( value );
49			return value;
50//			this._getCt('editor').tinymce().getContent();
51		},
52		setValue: function( value, context ) {
53			this._getCt('input').val( value );
54			return this._getCt('editor').html(value);
55			if( this.active ) {
56				// TODO: notify tinymce
57			}
58		},
59		prepareData: function() {
60			this.getValue();
61		},
62
63		addErrors: function() { return this._callParent(simpleClass,'addErrors',arguments); }, // implementaci si vypujcim z simple/bssimple, ikdyz z nej nededim
64		clearErrors: function() { return this._callParent(simpleClass,'addErrors',arguments); },
65
66		_activate: function() {
67			this._callParent('base','_activate',arguments);
68			this._getCt('editor').show().addClass('form-control fea-editor');
69			this._initEditor();
70		},
71		_deactivate: function() {
72			this._callParent('base','_deactivate',arguments);
73			var editor = this._getCt('editor');
74
75			editor.removeClass('form-control fea-editor');
76			editor.tinymce().remove();
77
78			if ( this.mode === 'editoronly' ) {
79				editor.hide();
80			}
81
82		},
83		_initEditor: function(){
84			// TODO: konfigurace na spravne misto
85			var me = this,
86				editor = me._getCt('editor'),
87				profile = me._getProp('profile', 'full'),
88				config = me.getConfig(profile)
89				;
90
91			editor.tinymce(config);
92		},
93		getConfig: function ( type ) {
94			//TODO: predelat na externi nastaveni!!!
95			if ( !this._configCache ) {
96
97				if(!window.Route) {
98					window.Route = function(url){return '/admin'+url;};
99				}
100
101				if(!window.T) {
102					window.T = function(key){return '?'+key+'?';};
103				}
104
105				this._configCache = new AW.TinyMCEConfig(window.vanilla_tinymce_config);
106			}
107			var cnf = this._configCache.getConfig(type);
108
109			cnf = $.extend({}, cnf, this._getBaseConfig());
110
111			if ( cnf.inline && cnf.content_css ) {
112				delete cnf.content_css;
113			}
114
115			return cnf;
116		},
117		_getBaseConfig: function () {
118			var me = this,
119				// TODO:
120				locale = 'cs';
121
122			var baseConfig = {
123				language: locale,
124				file_browser_callback: function(target_id, value, type, window){
125					var url = '/'+locale + '/admin/fea/index/filemanager';
126
127					var win = tinymce.activeEditor.windowManager.open({
128						url: url,
129						title: T('title_fea_tyny_fm'),
130						width: 800,
131						height: 600,
132						buttons:[
133							{
134								text: T('label_fea_tyny_fm_insert'),
135								subtype: 'primary',
136								onclick: function(){
137									var iframes = win.$el.find('iframe');
138									if ( iframes.length > 0 ) {
139										var value = iframes[0].contentWindow.getSelection();
140
141										if ( value ) {
142											//console.log(value);
143											 document.getElementById(target_id).value = value;
144											 win.close();
145										}
146										else {
147											tinymce.activeEditor.windowManager.alert(T('text_fea_tyny_fm_select_file'));
148										}
149									}
150									//console.log(win.$el.find('iframe'));
151								}
152							},{
153								text: T('label_fea_tyny_fm_cancel'),
154								onclick: function(){
155									win.close();
156								}
157							}
158						]
159					 }, {
160						type: type,
161						win: window,
162						value: value,
163						field_id: target_id
164					 });
165				},
166				resize: true,
167				hidden_input: false, // udelam si vlastni
168				inline: this.fea.helpers.toBool(me._getProp('inline', true))
169			};
170
171			return baseConfig;
172		},
173
174
175		getWysiwygEditor: function() {
176			return this._getCt('editor').tinymce();
177		}
178	});
179
180});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.