tb_core 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d872d85445d4c25392456def398ec02e4103b2d200272849c105063c75699e7
4
- data.tar.gz: a4fa137374414a058fce80a9169518b3978587e968c7a9b21d0a8982db1b86f0
3
+ metadata.gz: b601ae30b70478a2a908e9d8bc6dbf9b5ba8641edfd1768687f5472c5fd0b641
4
+ data.tar.gz: 0102a18e4e539fbe985e32c87eb38df5f6a68e9397316ff578d6bf9f86bd908b
5
5
  SHA512:
6
- metadata.gz: f7b229ce4e43d1012672432e6641005cc944926eef3a77fe5044cfc26ed591d0d572729ddbd7fb6a7c0ca27e9c559fe8aa05941815abcb2d29281af35637a9d0
7
- data.tar.gz: 1939d6ab1f5e361a89b0dc79f3dea4c023413cad9bb870a4f711241cdcb7dd6b8c0474b2a49321e686de3bf64ee86571c6ffb706bf0d736991dd1713de76d4d9
6
+ metadata.gz: bd894b75ba13119b6be69e1ce826d729333fd08f74f60ddd6393a666edc9fc7953449a58e6fce6b05e312625bc34e74afa8feac528932436d0f1488170184379
7
+ data.tar.gz: e4493e6a565cb75c8c0730bd220e4702ee7a19ab22bc371295cc84629ecab0a4012b4a6d81837ebaa5a8df63dfc46d3e6b8a0a7a18abcfdae24e419c760f779d
@@ -12,7 +12,9 @@ window.spud = { admin: window.tb };
12
12
 
13
13
  document.addEventListener('DOMContentLoaded', function() {
14
14
 
15
- tb.editor.init();
15
+ if (typeof tinymce != "undefined") {
16
+ tb.editor.init();
17
+ }
16
18
 
17
19
  $("#modal_window .modal-footer .form-submit").bind('click', function() {
18
20
  $("#modal_window .modal-body form").submit();
@@ -14,62 +14,28 @@ tb.editor = {};
14
14
  'undo', 'redo', '|',
15
15
  'bold','italic','underline','strikethrough','|',
16
16
  'formatselect','|',
17
- 'cut','copy','paste', 'pasteword','pastetext','|',
17
+ 'cut','copy','paste', '|',
18
18
  'bullist','numlist','outdent','indent','|',
19
19
  'link','unlink','image', '|', 'code', '|'
20
20
  ];
21
21
 
22
- var validElements = "@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|" +
23
- "onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|" +
24
- "onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|" +
25
- "name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u," +
26
- "#p,-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|" +
27
- "src|border|alt=|title|hspace|vspace|width|height|align|hidpi_src],-sub,-sup," +
28
- "-blockquote,-table[border=0|cellspacing|cellpadding|width|frame|rules|" +
29
- "height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|" +
30
- "height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot," +
31
- "#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor" +
32
- "|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div," +
33
- "-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face" +
34
- "|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite]," +
35
- "object[classid|width|height|codebase|*],param[name|value|_value],embed[type|width" +
36
- "|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo," +
37
- "button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|" +
38
- "valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method]," +
39
- "input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value]," +
40
- "kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value]," +
41
- "q[cite],samp,select[disabled|multiple|name|size],small," +
42
- "textarea[cols|rows|disabled|name|readonly],tt,var,big";
43
-
44
22
  var extendedValidElements = [
45
23
  "iframe[src|width|height|name|align|frameborder|allowfullscreen]"
46
24
  ];
47
25
 
48
26
  editor.init = function(options) {
49
27
  editor.unload();
50
- editor.checkAndCallTinyMce(options);
51
- };
52
28
 
53
- editor.initMCEWithOptions = function(element, options){
54
- var theme = options.theme || 'modern';
55
- var height = options.height || 400;
56
- var width = options.width || $(element).width();
57
- var buttons = options.buttons || registeredButtons;
58
- var plugins = options.plugins || registeredPlugins;
29
+ options = options || { selector: 'textarea.tinymce' };
59
30
 
60
- $(element).tinymce({
61
- theme: theme,
62
- language: 'en',
31
+ tinymce.init({
32
+ selector: options.selector,
33
+ height: 400,
63
34
  menubar: false,
64
- plugins: plugins.join(' '),
65
- toolbar: buttons.join(' '),
66
- convert_urls: false,
67
- valid_elements: validElements,
68
- media_strict: false,
69
- extended_valid_elements: extendedValidElements.join(","),
70
- width: width,
71
- height: height
72
- });
35
+ toolbar: registeredButtons.join(' '),
36
+ plugins: registeredPlugins.join(' '),
37
+ extended_valid_elements: extendedValidElements.join(",")
38
+ })
73
39
  };
74
40
 
75
41
  editor.unload = function() {
@@ -111,32 +77,4 @@ tb.editor = {};
111
77
  }
112
78
  };
113
79
 
114
- var loadScript = null;
115
-
116
- editor.checkAndCallTinyMce = function(options){
117
- options = options || {};
118
- var selector = options.selector || 'textarea.tinymce';
119
- var $elements = $(selector);
120
-
121
- if($elements.length === 0){
122
- return;
123
- }
124
-
125
- if(loadScript === null){
126
- loadScript = $.when(
127
- $.ajax({url: '//cdn.tinymce.com/4.3/tinymce.min.js', dataType: 'script', cache: true}),
128
- $.ajax({url: '//cdn.tinymce.com/4.3/jquery.tinymce.min.js', dataType: 'script', cache: true})
129
- ).done(function(){
130
- $('body').trigger("tb:tinymce-loaded");
131
- editor.tinymce.loaded = true;
132
- });
133
- }
134
-
135
- loadScript.done(function(){
136
- $elements.each(function(){
137
- editor.initMCEWithOptions(this, options);
138
- });
139
- });
140
- };
141
-
142
80
  })();
@@ -2,6 +2,7 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <title><%= TbCore.config.site_name %> Admin</title>
5
+ <%= tinymce_assets unless ENV['TB_SKIP_TINYMCE'] %>
5
6
  <%= stylesheet_link_tag *TbCore.config.admin_stylesheets %>
6
7
  <%= javascript_include_tag *TbCore.config.admin_javascripts %>
7
8
  <%= csrf_meta_tags %>
@@ -7,6 +7,7 @@ require 'will_paginate-bootstrap'
7
7
  require 'breadcrumbs_on_rails'
8
8
  require 'rails-ujs'
9
9
  require 'sortable_by'
10
+ require 'tinymce-rails'
10
11
 
11
12
  module Spud
12
13
  end
@@ -1,3 +1,3 @@
1
1
  module TbCore
2
- VERSION = '1.5.1'.freeze
2
+ VERSION = '1.5.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tb_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Woods
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-10 00:00:00.000000000 Z
11
+ date: 2021-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: authlogic
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: tinymce-rails
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: will_paginate
155
169
  requirement: !ruby/object:Gem::Requirement