tenon 1.0.63 → 1.0.64

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
  SHA1:
3
- metadata.gz: 23b0d012cdae23e290d059730747281078281147
4
- data.tar.gz: 0cf76efc8f5aa0517a0f1da732c079cb3ec8b947
3
+ metadata.gz: 6f3bb8fc3acef8312449faf8293c92c178306bf1
4
+ data.tar.gz: 5b0c621ac9c92ed87398defe1a3e43869bb30424
5
5
  SHA512:
6
- metadata.gz: 20b2271b44896595b04211866bc87d1fad2e1e39835c1c3f214a9ac8e034a26028233ab0ed5c20c6a3f24c7ad9d4d53e33ead62d8a1578705bc0113bee4c16c7
7
- data.tar.gz: 69455c50c097aa22075ab57cb127b73705d44ce1606e3ba7f780c3bedf6562cce14b24dbeee8fde8dd59aef48247de8ce9ab89db31a59911c56fe425e91b56d3
6
+ metadata.gz: fa06c54b7d95271469a7da5407cb26ac7ad0fb4b32e5b1546467f232af34c0376ccd667c7fe7bc2f1064bd7f0f3de8fa407c9d5d91366ec21c6710466301a3fb
7
+ data.tar.gz: ee36da52199fe2dccab5a1f00b8e04c412367c6b23b1ecab5bc95c1ab7f4e5c1a846739479e34105013cf6c88ea7b5cd2e5f68c55e53af62fb6ba9a572e81cb6
@@ -97,7 +97,7 @@ if (typeof module === 'object') {
97
97
  allowMultiParagraphSelection: true,
98
98
  anchorInputPlaceholder: 'Paste or type a link',
99
99
  anchorPreviewHideDelay: 500,
100
- buttons: ['bold', 'italic', 'underline', 'anchor', 'header1', 'header2', 'quote'],
100
+ buttons: ['bold', 'italic', 'underline', 'anchor', 'header1', 'header2', 'header3', 'header4', 'quote'],
101
101
  buttonLabels: false,
102
102
  checkLinkFormat: false,
103
103
  cleanPastedHTML: false,
@@ -110,9 +110,11 @@ if (typeof module === 'object') {
110
110
  disableEditing: false,
111
111
  elementsContainer: false,
112
112
  firstHeader: 'h3',
113
+ secondHeader: 'h4',
114
+ thirdHeader: 'h5',
115
+ fourthHeader: 'h6',
113
116
  forcePlainText: true,
114
117
  placeholder: 'Type your text',
115
- secondHeader: 'h4',
116
118
  targetBlank: false,
117
119
  extensions: {}
118
120
  },
@@ -323,6 +325,8 @@ if (typeof module === 'object') {
323
325
  'image': '<button class="medium-editor-action medium-editor-action-image" data-action="image" data-element="img">' + buttonLabels.image + '</button>',
324
326
  'header1': '<button class="medium-editor-action medium-editor-action-header1" data-action="append-' + this.options.firstHeader + '" data-element="' + this.options.firstHeader + '">' + buttonLabels.header1 + '</button>',
325
327
  'header2': '<button class="medium-editor-action medium-editor-action-header2" data-action="append-' + this.options.secondHeader + '" data-element="' + this.options.secondHeader + '">' + buttonLabels.header2 + '</button>',
328
+ 'header3': '<button class="medium-editor-action medium-editor-action-header3" data-action="append-' + this.options.thirdHeader + '" data-element="' + this.options.thirdHeader + '">' + buttonLabels.header3 + '</button>',
329
+ 'header4': '<button class="medium-editor-action medium-editor-action-header4" data-action="append-' + this.options.fourthHeader + '" data-element="' + this.options.fourthHeader + '">' + buttonLabels.header4 + '</button>',
326
330
  'quote': '<button class="medium-editor-action medium-editor-action-quote" data-action="append-blockquote" data-element="blockquote">' + buttonLabels.quote + '</button>',
327
331
  'orderedlist': '<button class="medium-editor-action medium-editor-action-orderedlist" data-action="insertorderedlist" data-element="ol">' + buttonLabels.orderedlist + '</button>',
328
332
  'unorderedlist': '<button class="medium-editor-action medium-editor-action-unorderedlist" data-action="insertunorderedlist" data-element="ul">' + buttonLabels.unorderedlist + '</button>',
@@ -347,6 +351,8 @@ if (typeof module === 'object') {
347
351
  'image': '<b>image</b>',
348
352
  'header1': '<b>H1</b>',
349
353
  'header2': '<b>H2</b>',
354
+ 'header3': '<b>H3</b>',
355
+ 'header4': '<b>H4</b>',
350
356
  'quote': '<b>&ldquo;</b>',
351
357
  'orderedlist': '<b>1.</b>',
352
358
  'unorderedlist': '<b>&bull;</b>',
@@ -391,7 +397,8 @@ if (typeof module === 'object') {
391
397
  this.keepToolbarAlive = false;
392
398
  this.anchorForm = this.toolbar.querySelector('.medium-editor-toolbar-form-anchor');
393
399
  this.anchorInput = this.anchorForm.querySelector('input.medium-editor-toolbar-anchor-input');
394
- this.anchorTarget = this.anchorForm.querySelector('input.medium-editor-toolbar-anchor-target');
400
+ this.anchorTarget = this.anchorForm.querySelector('input.medium-editor-toolbar-anchor-target-input');
401
+ this.anchorBtn = this.anchorForm.querySelector('input.medium-editor-toolbar-anchor-btn-input');
395
402
  this.toolbarActions = this.toolbar.querySelector('.medium-editor-toolbar-actions');
396
403
  this.anchorPreview = this.createAnchorPreview();
397
404
 
@@ -429,6 +436,7 @@ if (typeof module === 'object') {
429
436
  }
430
437
 
431
438
  if (btn) {
439
+
432
440
  li = document.createElement('li');
433
441
  if (isElement(btn)) {
434
442
  li.appendChild(btn);
@@ -450,6 +458,9 @@ if (typeof module === 'object') {
450
458
  target_wrap = document.createElement('div'),
451
459
  target_label = document.createElement('label'),
452
460
  target = document.createElement('input'),
461
+ btn_wrap = document.createElement('div'),
462
+ btn_label = document.createElement('label'),
463
+ btn = document.createElement('input'),
453
464
  icon = document.createElement('i');
454
465
 
455
466
  cancel.setAttribute('href', '#');
@@ -465,15 +476,24 @@ if (typeof module === 'object') {
465
476
  asset_button.setAttribute('data-modal-title', 'Link to Asset');
466
477
  asset_button.setAttribute('data-modal-handler', 'Tenon.features.tenonContent.AssetLink');
467
478
 
468
- target.className = 'medium-editor-toolbar-anchor-target';
479
+ target.className = 'medium-editor-toolbar-anchor-checkbox medium-editor-toolbar-anchor-target-input';
469
480
  target.setAttribute('type', 'checkbox')
470
481
  target.setAttribute('title', 'Open in New Window?')
471
482
  target.setAttribute('data-tooltip', 'true');
472
- target_label.className = 'medium-editor-toolbar-anchor-target-label';
473
- target_wrap.className = 'medium-editor-toolbar-anchor-target-wrap';
483
+ target_label.className = 'medium-editor-toolbar-anchor-checkbox-label medium-editor-toolbar-anchor-target-label';
484
+ target_wrap.className = 'medium-editor-toolbar-anchor-checkbox-wrap medium-editor-toolbar-anchor-target';
474
485
  target_wrap.insertBefore(target_label, target_wrap.firstChild);
475
486
  target_wrap.insertBefore(target, target_wrap.firstChild);
476
487
 
488
+ btn.className = 'medium-editor-toolbar-anchor-checkbox medium-editor-toolbar-anchor-btn-input';
489
+ btn.setAttribute('type', 'checkbox')
490
+ btn.setAttribute('title', 'Style as a button?')
491
+ btn.setAttribute('data-tooltip', 'true');
492
+ btn_label.className = 'medium-editor-toolbar-anchor-checkbox-label medium-editor-toolbar-anchor-btn-label';
493
+ btn_wrap.className = 'medium-editor-toolbar-anchor-checkbox-wrap medium-editor-toolbar-anchor-btn';
494
+ btn_wrap.insertBefore(btn_label, btn_wrap.firstChild);
495
+ btn_wrap.insertBefore(btn, btn_wrap.firstChild);
496
+
477
497
  input.className = 'medium-editor-toolbar-anchor-input';
478
498
  input.setAttribute('type', 'text');
479
499
  input.setAttribute('placeholder', this.options.anchorInputPlaceholder);
@@ -482,6 +502,7 @@ if (typeof module === 'object') {
482
502
  anchor.id = 'medium-editor-toolbar-form-anchor';
483
503
  if (!this.isIE) { anchor.appendChild(asset_button); }
484
504
  anchor.appendChild(input);
505
+ anchor.appendChild(btn_wrap);
485
506
  anchor.appendChild(target_wrap);
486
507
  anchor.appendChild(cancel);
487
508
 
@@ -849,7 +870,15 @@ if (typeof module === 'object') {
849
870
  self.anchorTarget.checked = false;
850
871
  }
851
872
 
852
- self.createLink(this, target);
873
+ // set class for link and pass to createLink()
874
+ var btn = "";
875
+ if (self.anchorBtn.checked) {
876
+ btn = "btn";
877
+ // reset target state to false:
878
+ self.anchorBtn.checked = false;
879
+ }
880
+
881
+ self.createLink(this, target, btn);
853
882
  }
854
883
  });
855
884
  this.anchorInput.addEventListener('click', function (e) {
@@ -1070,7 +1099,23 @@ if (typeof module === 'object') {
1070
1099
  }
1071
1100
  },
1072
1101
 
1073
- createLink: function (input, target) {
1102
+ setBtnClass: function (href) {
1103
+ var el = getSelectionStart(),
1104
+ i;
1105
+ if (el.tagName.toLowerCase() === 'a') {
1106
+ el.className = 'btn';
1107
+ } else {
1108
+ el = el.getElementsByTagName('a');
1109
+ for (i = 0; i < el.length; i += 1) {
1110
+ if ( el[i].getAttribute('href') === href) {
1111
+ el[i].className = 'btn';
1112
+ }
1113
+ }
1114
+ }
1115
+ console.log(el);
1116
+ },
1117
+
1118
+ createLink: function (input, target, btn) {
1074
1119
  restoreSelection(this.savedSelection);
1075
1120
  if (this.options.checkLinkFormat) {
1076
1121
  input.value = this.checkLinkFormat(input.value);
@@ -1082,6 +1127,10 @@ if (typeof module === 'object') {
1082
1127
  this.setTargetBlank(input.value);
1083
1128
  }
1084
1129
 
1130
+ if (btn === "btn") {
1131
+ this.setBtnClass(input.value);
1132
+ }
1133
+
1085
1134
  this.triggerChange();
1086
1135
 
1087
1136
  this.checkSelection();
@@ -31,7 +31,7 @@
31
31
  .medium-editor-toolbar-form-anchor {
32
32
  input {
33
33
  height: 56px;
34
- &.medium-editor-toolbar-anchor-target {
34
+ &.medium-editor-toolbar-anchor-checkbox {
35
35
  position: absolute;
36
36
  z-index: 1;
37
37
  top: 0;
@@ -45,19 +45,21 @@
45
45
  cursor: pointer;
46
46
  opacity: 0;
47
47
  &:checked + .medium-editor-toolbar-anchor-target-label:before {
48
- // content: '\f08e'; // external-light
49
- content: '\f14c'; // external-dark
48
+ content: '\f14c';
49
+ }
50
+ &:checked + .medium-editor-toolbar-anchor-btn-label:before {
51
+ content: '\f14a';
50
52
  }
51
53
  }
52
54
  }
53
- .medium-editor-toolbar-anchor-target-wrap {
55
+ .medium-editor-toolbar-anchor-checkbox-wrap {
54
56
  position: relative;
55
57
  top: 2px;
56
58
  display: inline-block;
57
59
  margin: 0;
58
60
  padding: 0;
59
61
  }
60
- label.medium-editor-toolbar-anchor-target-label {
62
+ label.medium-editor-toolbar-anchor-checkbox-label {
61
63
  display: inline-block;
62
64
  width: auto;
63
65
  margin: 0 6px;
@@ -67,8 +69,7 @@
67
69
  font-size: 18px;
68
70
  line-height: 30px;
69
71
  display: block;
70
- content: '\f0c8'; // square-dark
71
- // content: '\f096'; // square-light
72
+ content: '\f0c8';
72
73
  color: white;
73
74
  }
74
75
  }
@@ -141,10 +141,15 @@
141
141
  padding: 5px;
142
142
  outline: none;
143
143
  background: #fff;
144
- h3, h4, p, ul, ol {
144
+ h1, h2, h3, h4, h5, h6, p, ul, ol {
145
145
  margin: 0 0 $tn-margin;
146
146
  padding-top: 0;
147
147
  }
148
+ .btn {
149
+ background-color: $tn-primary;
150
+ color: white;
151
+ margin: 0 10px;
152
+ }
148
153
  }
149
154
  a.add-image {
150
155
  span {
data/lib/tenon/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tenon
2
- VERSION = '1.0.63'
2
+ VERSION = '1.0.64'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tenon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.63
4
+ version: 1.0.64
5
5
  platform: ruby
6
6
  authors:
7
7
  - factor[e] design initiative
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-18 00:00:00.000000000 Z
11
+ date: 2015-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: better_errors