dante-editor 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +2 -0
  5. data/ROADMAP.md +1 -1
  6. data/TODO.md +1 -0
  7. data/app/assets/javascripts/dante/dante.js.coffee.erb +1 -0
  8. data/app/assets/javascripts/dante/editor.js.coffee +50 -57
  9. data/app/assets/javascripts/dante/menu.js.coffee +11 -11
  10. data/app/assets/javascripts/dante/popover.js.coffee +76 -0
  11. data/app/assets/javascripts/dante.js +1 -0
  12. data/app/assets/stylesheets/dante/_caption.scss +52 -0
  13. data/app/assets/stylesheets/dante/_graf.scss +101 -29
  14. data/app/assets/stylesheets/dante/_media.scss +39 -0
  15. data/app/assets/stylesheets/dante/_needsorder.scss +92 -90
  16. data/app/assets/stylesheets/dante/_popover.scss +134 -0
  17. data/app/assets/stylesheets/dante/_post.scss +43 -2
  18. data/app/assets/stylesheets/dante/_scaffold.scss +1 -0
  19. data/app/assets/stylesheets/dante/_variables.scss +3 -1
  20. data/app/assets/stylesheets/dante.css.scss +3 -0
  21. data/lib/dante-editor/version.rb +1 -1
  22. data/source/assets/images/dante-editor-logo.png +0 -0
  23. data/source/assets/stylesheets/_scaffold.scss +1 -5
  24. data/source/assets/stylesheets/_tooltips.scss +2 -2
  25. data/source/assets/stylesheets/all.css.scss +39 -36
  26. data/source/index.html.erb +7 -8
  27. data/source/layouts/layout.erb +6 -5
  28. metadata +7 -8
  29. data/app/assets/stylesheets/temp/fonts.css.scss +0 -80
  30. data/app/assets/stylesheets/temp/medium.css +0 -12404
  31. data/app/assets/stylesheets/temp/review.scss +0 -21
  32. data/app/assets/stylesheets/temp/structure.haml +0 -22
  33. data/source/assets/images/dante-logo.png +0 -0
  34. data/source/assets/images/icon-logo.png +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64b4e8827f1fd8a73d53ea8a3d2096428c512777
4
- data.tar.gz: bfcca07541a5c1b66e5fb750fdb0eb0d9fc3cdd5
3
+ metadata.gz: 5df180cc7b05573d27375f1d68407eae113faafa
4
+ data.tar.gz: 0c20ba63a6873253fe41dee4b53ddbde40668793
5
5
  SHA512:
6
- metadata.gz: 9e18ede5c0fcb9553798120b174c3cd05f17d8f785870b03c60e78d0e569783123cfcc3504af2b8dcb5a3d05fe5097aaa5d2dca06280e441b3df5304cbab9939
7
- data.tar.gz: 890dfde37222b9741982b8c31f2b91b137a47bd1c6dea6902e4004c853d2916cd984bd893f109c118d401b46ecee365271058f18f19deab5378ecdb88aeaa234
6
+ metadata.gz: 7027a936bf5598765a5dc0f23ca29b9e8f024cb659f19efcfdb31c64418d3bbce8cb2545c167f7ac276f4ca77b84bda88e318bd3dd5c3a947a6a0b6ba4c90e3d
7
+ data.tar.gz: 6c4b90531e4971941b527324bf7b339d100aaf50a472c6827bbe0ea37272d8e4185fa196aa361d3c69220d51a1a004307227150717e375986806ba4fef05db1d
data/.gitignore CHANGED
@@ -20,6 +20,7 @@
20
20
  /node_modules
21
21
 
22
22
  /tmp/images/**/*
23
+ /app/assets/stylesheets/temp/**/*
23
24
 
24
25
 
25
26
  /.yardoc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dante-editor (0.0.4)
4
+ dante-editor (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  #Dante Editor
2
2
 
3
+ [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/michelson/Dante?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
+
3
5
  ####Just another Medium editor clone.
4
6
 
5
7
  ##Motivation:
data/ROADMAP.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## ROADMAP
2
2
 
3
- + 0.0.5
3
+ + 0.0.6
4
4
  + TODO LIST COMPLETE!
5
5
  + 0.0.7
6
6
  + implement Keyboard Shortcuts / word count / typing tricks
data/TODO.md CHANGED
@@ -13,6 +13,7 @@
13
13
  + DELETE
14
14
  + handle remove from PRE tag, it set rare span, just remove it
15
15
  + clean node when remove one
16
+ + don't remove entire graf-image when delete text from caption
16
17
 
17
18
  + IMAGES:
18
19
  + upload, show progress, complete
@@ -1,6 +1,7 @@
1
1
  window.Dante = {
2
2
  Editor: {
3
3
  ToolTip: {}
4
+ PopOver: {}
4
5
  Menu: {}
5
6
  }
6
7
  defaults:
@@ -1,11 +1,9 @@
1
1
 
2
- selected_menu = false
3
2
  utils = Dante.utils
4
3
 
5
4
  class Dante.Editor extends Dante.View
6
5
 
7
6
  events:
8
- #"blur" : "handleBlur"
9
7
  "mouseup" : "handleMouseUp"
10
8
  "keydown" : "handleKeyDown"
11
9
  "keyup" : "handleKeyUp"
@@ -15,6 +13,10 @@ class Dante.Editor extends Dante.View
15
13
  "drop" : "handleDrag"
16
14
  "click .graf--figure .aspectRatioPlaceholder" : "handleGrafFigureSelectImg"
17
15
  "click .graf--figure figcaption" : "handleGrafFigureSelectCaption"
16
+ "keyup .graf--figure figcaption" : "handleGrafCaptionTyping"
17
+
18
+ "mouseover .markup--anchor" : "displayPopOver"
19
+ "mouseout .markup--anchor" : "hidePopOver"
18
20
 
19
21
  initialize: (opts = {})=>
20
22
  @editor_options = opts
@@ -81,7 +83,7 @@ class Dante.Editor extends Dante.View
81
83
  </div>
82
84
 
83
85
  <div class='section-content'>
84
- <div class='section-inner'>
86
+ <div class='section-inner layoutSingleColumn'>
85
87
  #{if @disable_title then '' else @renderTitle()}
86
88
  <p class='graf graf--p'>#{@body_placeholder}<p>
87
89
  </div>
@@ -97,6 +99,8 @@ class Dante.Editor extends Dante.View
97
99
  $("<div class='inlineTooltip'></div>").insertAfter(@el)
98
100
  @editor_menu = new Dante.Editor.Menu(editor: @)
99
101
  @tooltip_view = new Dante.Editor.Tooltip(editor: @)
102
+ @pop_over = new Dante.Editor.PopOver(editor: @)
103
+ @pop_over.render().hide()
100
104
  @tooltip_view.render().hide()
101
105
 
102
106
  appendInitialContent: ()=>
@@ -107,12 +111,11 @@ class Dante.Editor extends Dante.View
107
111
  @render()
108
112
  $(@el).attr("contenteditable", "true")
109
113
  $(@el).addClass("postField postField--body editable smart-media-plugin")
110
- $(@el).wrap("<div class='postContent'><div class='notesSource'></div></div>")
114
+ $(@el).wrap("<article class='postArticle'><div class='postContent'><div class='notesSource'></div></div></article>")
111
115
  @appendMenus()
112
116
  @appendInitialContent() unless _.isEmpty @initial_html.trim()
113
117
  @parseInitialMess()
114
118
 
115
-
116
119
  restart: ()=>
117
120
  @render()
118
121
 
@@ -175,7 +178,6 @@ class Dante.Editor extends Dante.View
175
178
  precedingChar
176
179
 
177
180
  isLastChar: ()->
178
- #utils.log "#{$(@getNode()).text().trim().length} | #{@getCharacterPrecedingCaret().trim().length}"
179
181
  $(@getNode()).text().trim().length is @getCharacterPrecedingCaret().trim().length
180
182
 
181
183
  isFirstChar: ()->
@@ -197,7 +199,6 @@ class Dante.Editor extends Dante.View
197
199
  range.collapse(true)
198
200
  sel.removeAllRanges()
199
201
  sel.addRange(range)
200
- #@el.focus()
201
202
  element.focus()
202
203
 
203
204
  #set focus and caret position on element
@@ -237,7 +238,6 @@ class Dante.Editor extends Dante.View
237
238
  (if root && root.contains(node) then node else null)
238
239
 
239
240
  displayMenu: (sel)->
240
- #return if _.isUndefined sel
241
241
  setTimeout ()=>
242
242
  @editor_menu.render()
243
243
  pos = utils.getSelectionDimensions()
@@ -248,6 +248,13 @@ class Dante.Editor extends Dante.View
248
248
  handleDrag: ()->
249
249
  return false
250
250
 
251
+ handleGrafCaptionTyping: (ev)->
252
+ if _.isEmpty(utils.getNode().textContent.trim())
253
+ $(@getNode()).addClass("is-defaultValue")
254
+ else
255
+ $(@getNode()).removeClass("is-defaultValue")
256
+
257
+
251
258
  #get text of selected and displays menu
252
259
  handleTextSelection: (anchor_node)->
253
260
  @editor_menu.hide()
@@ -270,6 +277,12 @@ class Dante.Editor extends Dante.View
270
277
  $(".graf--first").html(@title_placeholder)
271
278
  $(".graf--last").html(@body_placeholder)
272
279
 
280
+ displayPopOver: (ev)->
281
+ @pop_over.displayAt(ev)
282
+
283
+ hidePopOver: (ev)->
284
+ @pop_over.hide(ev)
285
+
273
286
  handleGrafFigureSelectImg: (ev)->
274
287
  utils.log "FIGURE SELECT"
275
288
  element = ev.currentTarget
@@ -281,22 +294,10 @@ class Dante.Editor extends Dante.View
281
294
  utils.log "FIGCAPTION"
282
295
  element = ev.currentTarget
283
296
  $(element).parent(".graf--figure").removeClass("is-mediaFocused")
284
- #return false
285
- #@setRangeAt( $(element).find('.imageCaption')[0] )
286
-
287
- handleBlur: (ev)=>
288
- #hide menu only if is not in use
289
- setTimeout ()=>
290
- utils.log "not in use"
291
- #@editor_menu.hide() unless selected_menu
292
- , 200
293
- false
294
297
 
295
298
  handleMouseUp: (ev)=>
296
299
  utils.log "MOUSE UP"
297
300
  anchor_node = @getNode()
298
- #utils.log anchor_node
299
- #utils.log ev.currentTarget
300
301
 
301
302
  return if _.isNull(anchor_node)
302
303
 
@@ -337,7 +338,6 @@ class Dante.Editor extends Dante.View
337
338
 
338
339
  when "Down"
339
340
  #when graff-image selected but none selection is found
340
- #debugger
341
341
  if _.isUndefined(current_node) or !current_node.exists()
342
342
  if $(".is-selected").exists()
343
343
  current_node = $(".is-selected")
@@ -355,13 +355,12 @@ class Dante.Editor extends Dante.View
355
355
  #if next element is embed select & focus it
356
356
  if next_node.hasClass("graf--figure") && caret_node
357
357
  n = next_node.find(".imageCaption")
358
- @setRangeAt n[0]
359
358
  @scrollTo(n)
360
359
  utils.log "1 down"
361
360
  utils.log n[0]
362
361
  @skip_keyup = true
363
362
  @selection().removeAllRanges()
364
- #@markAsSelected(next_node)
363
+ @markAsSelected(next_node)
365
364
  next_node.addClass("is-mediaFocused is-selected")
366
365
  return false
367
366
  #if current node is embed
@@ -394,11 +393,11 @@ class Dante.Editor extends Dante.View
394
393
  if prev_node.hasClass("graf--figure")
395
394
  utils.log "1 up"
396
395
  n = prev_node.find(".imageCaption")
397
- #@setRangeAt n[0]
398
396
  @scrollTo(n)
399
397
  @skip_keyup = true
400
398
  @selection().removeAllRanges()
401
- prev_node.addClass("is-mediaFocused is-selected")
399
+ @markAsSelected(prev_node)
400
+ prev_node.addClass("is-mediaFocused")
402
401
  return false
403
402
 
404
403
  else if prev_node.hasClass("graf--mixtapeEmbed")
@@ -418,15 +417,12 @@ class Dante.Editor extends Dante.View
418
417
  else if prev_node.hasClass("graf")
419
418
  n = current_node.prev(".graf")
420
419
  num = n[0].childNodes.length
421
- #@setRangeAt n[0], num
422
420
  @scrollTo(n)
423
421
  utils.log "4 up"
424
422
  @skip_keyup = true
425
- #debugger
423
+ @markAsSelected(prev_node)
426
424
  return false
427
425
 
428
- utils.log "noting"
429
-
430
426
  #parse text for initial mess
431
427
  parseInitialMess: ()->
432
428
  @setupElementsClasses $(@el).find('.section-inner') , ()=>
@@ -452,7 +448,7 @@ class Dante.Editor extends Dante.View
452
448
  cbd = ev.originalEvent.clipboardData
453
449
  pastedText = if _.isEmpty(cbd.getData('text/html')) then cbd.getData('text/plain') else cbd.getData('text/html')
454
450
 
455
- #alert(pastedText) # Process and handle text...
451
+ utils.log(pastedText) # Process and handle text...
456
452
  #detect if is html
457
453
  if pastedText.match(/<\/*[a-z][^>]+?>/gi)
458
454
  utils.log("HTML DETECTED ON PASTE")
@@ -603,7 +599,6 @@ class Dante.Editor extends Dante.View
603
599
  else if parent.hasClass("is-extractable")
604
600
  @tooltip_view.getExtractFromNode($(anchor_node))
605
601
 
606
-
607
602
  #supress linebreak into embed page text unless last char
608
603
  if parent.hasClass("graf--mixtapeEmbed") or parent.hasClass("graf--iframe") or parent.hasClass("graf--figure")
609
604
  utils.log("supress linebreak from embed !(last char)")
@@ -626,17 +621,20 @@ class Dante.Editor extends Dante.View
626
621
  if (anchor_node && @editor_menu.lineBreakReg.test(anchor_node.nodeName))
627
622
  #new paragraph if it the last character
628
623
  if @isLastChar()
629
- utils.log "new paragraph if it the last character"
624
+ utils.log "new paragraph if it's the last character"
630
625
  e.preventDefault()
631
626
  @handleLineBreakWith("p", parent)
632
627
 
633
628
  setTimeout ()=>
634
629
  node = @getNode()
635
- @markAsSelected( @getNode() ) #if anchor_node
636
- @setupFirstAndLast()
637
630
  #set name on new element
638
631
  @setElementName($(node))
639
632
 
633
+ if node.nodeName.toLowerCase() is "div"
634
+ node = @replaceWith("p", $(node))[0]
635
+ @markAsSelected( $(node) ) #if anchor_node
636
+ @setupFirstAndLast()
637
+
640
638
  #empty childs if text is empty
641
639
  if _.isEmpty $(node).text().trim()
642
640
  _.each $(node).children(), (n)->
@@ -682,15 +680,12 @@ class Dante.Editor extends Dante.View
682
680
  if $(anchor_node).prev().hasClass("graf--mixtapeEmbed")
683
681
  return false if @isFirstChar() && !_.isEmpty( $(anchor_node).text().trim() )
684
682
 
685
- utils.log "sss"
686
683
  utils.log anchor_node
687
684
  if $(".is-selected").hasClass("graf--figure")
688
685
  @replaceWith("p", $(".is-selected"))
689
686
  @setRangeAt($(".is-selected")[0])
690
687
  return false
691
688
 
692
-
693
-
694
689
  #arrows key
695
690
  #if _.contains([37,38,39,40], e.which)
696
691
  #up & down
@@ -717,7 +712,7 @@ class Dante.Editor extends Dante.View
717
712
  if @skip_keyup
718
713
  @skip_keyup = null
719
714
  utils.log "SKIP KEYUP"
720
- return
715
+ return false
721
716
 
722
717
  utils.log "KEYUP"
723
718
 
@@ -740,7 +735,13 @@ class Dante.Editor extends Dante.View
740
735
 
741
736
  if $(utils_anchor_node).hasClass("section-content") || $(utils_anchor_node).hasClass("graf--first")
742
737
  utils.log "SECTION DETECTED FROM KEYUP #{_.isEmpty($(utils_anchor_node).text())}"
743
- return false if _.isEmpty($(utils_anchor_node).text())
738
+ if _.isEmpty($(utils_anchor_node).text())
739
+ next_graf = $(utils_anchor_node).next(".graf")[0]
740
+ if next_graf
741
+ @setRangeAt next_graf
742
+ $(utils_anchor_node).remove()
743
+ @setupFirstAndLast()
744
+ return false
744
745
 
745
746
  if _.isNull(anchor_node)
746
747
  @handleNullAnchor()
@@ -748,14 +749,19 @@ class Dante.Editor extends Dante.View
748
749
 
749
750
  if $(anchor_node).hasClass("graf--first")
750
751
  utils.log "THE FIRST ONE! UP"
752
+
753
+ if @.getSelectedText() is @.getNode().textContent
754
+ utils.log "remove selection dectected"
755
+ @.getNode().innerHTML = "<br>"
756
+
751
757
  @markAsSelected(anchor_node)
752
758
  @setupFirstAndLast()
753
759
  false
754
760
 
755
- if anchor_node
756
- @markAsSelected(anchor_node)
757
- @setupFirstAndLast()
758
- @displayTooltipAt($(@el).find(".is-selected"))
761
+ #if anchor_node
762
+ # @markAsSelected(anchor_node)
763
+ # @setupFirstAndLast()
764
+ # @displayTooltipAt($(@el).find(".is-selected"))
759
765
 
760
766
  #arrows key
761
767
  if _.contains([37,38,39,40], e.which)
@@ -778,6 +784,7 @@ class Dante.Editor extends Dante.View
778
784
  from_element.replaceWith(new_paragraph)
779
785
  @setRangeAt(new_paragraph[0])
780
786
  @scrollTo new_paragraph
787
+ new_paragraph
781
788
 
782
789
  #shows the (+) tooltip at current element
783
790
  displayTooltipAt: (element)->
@@ -798,20 +805,6 @@ class Dante.Editor extends Dante.View
798
805
  $(@el).find(".is-selected").removeClass("is-mediaFocused is-selected")
799
806
  $(element).addClass("is-selected")
800
807
 
801
- ###
802
- if $(element).prop("tagName").toLowerCase() is "figure"
803
- $(element).addClass("is-mediaFocused")
804
- n = utils.getNode()
805
- utils.log n
806
-
807
- n = utils.getNode()
808
- utils.log n
809
- if _.isUndefined n
810
- $(element).addClass("is-mediaFocused")
811
- else if $(n).prop("tagName").toLowerCase() is "figcaption"
812
- $(element).removeClass("is-mediaFocused")
813
- ###
814
-
815
808
  $(element).find(".defaultValue").remove()
816
809
  #set reached top if element is first!
817
810
  if $(element).hasClass("graf--first")
@@ -6,8 +6,6 @@ class Dante.Editor.Menu extends Dante.View
6
6
  events:
7
7
  "mousedown li" : "handleClick"
8
8
  "click .dante-menu-linkinput .dante-menu-button": "closeInput"
9
- "mouseenter" : "handleOver"
10
- "mouseleave" : "handleOut"
11
9
  "keypress input": "handleInputEnter"
12
10
 
13
11
  initialize: (opts={})=>
@@ -52,7 +50,6 @@ class Dante.Editor.Menu extends Dante.View
52
50
  render: ()=>
53
51
  $(@el).html(@template())
54
52
  @show()
55
- #@delegateEvents()
56
53
 
57
54
  handleClick: (ev)->
58
55
  element = $(ev.currentTarget).find('.dante-icon')
@@ -62,8 +59,11 @@ class Dante.Editor.Menu extends Dante.View
62
59
  @savedSel = utils.saveSelection()
63
60
 
64
61
  if /(?:createlink)/.test(action)
65
- $(@el).addClass("dante-menu--linkmode")
66
- input.focus()
62
+ if $(ev.currentTarget).hasClass("active")
63
+ @removeLink()
64
+ else
65
+ $(@el).addClass("dante-menu--linkmode")
66
+ input.focus()
67
67
  else
68
68
  @menuApply action
69
69
 
@@ -78,6 +78,11 @@ class Dante.Editor.Menu extends Dante.View
78
78
  utils.restoreSelection(@savedSel)
79
79
  return @createlink( $(e.target) )
80
80
 
81
+ removeLink: ()->
82
+ @menuApply "unlink"
83
+ elem = @current_editor.getNode()
84
+ @current_editor.cleanContents($(elem))
85
+
81
86
  createlink: (input) =>
82
87
  $(@el).removeClass("dante-menu--linkmode")
83
88
  if input.val()
@@ -160,12 +165,6 @@ class Dante.Editor.Menu extends Dante.View
160
165
  el = el.parentNode
161
166
  nodes
162
167
 
163
- handleOut: ()->
164
- selected_menu = false
165
-
166
- handleOver: ()->
167
- selected_menu = true
168
-
169
168
  displayHighlights: ()->
170
169
  #remove all active links
171
170
  $(@el).find(".active").removeClass("active")
@@ -207,6 +206,7 @@ class Dante.Editor.Menu extends Dante.View
207
206
 
208
207
  show: ()->
209
208
  $(@el).addClass("dante-menu--active")
209
+ @closeInput()
210
210
  @displayHighlights()
211
211
 
212
212
  hide: ()->
@@ -0,0 +1,76 @@
1
+ utils = Dante.utils
2
+
3
+ class Dante.Editor.PopOver extends Dante.View
4
+ el: "body"
5
+
6
+ events:
7
+ "mouseover .popover": "cancelHide"
8
+ "mouseout .popover": "hide"
9
+
10
+ initialize: (opts = {})->
11
+ utils.log("initialized popover")
12
+ @editor = opts.editor
13
+ @hideTimeout
14
+ @settings = {timeout: 300}
15
+
16
+ template: ()->
17
+ "<div class='popover popover--tooltip popover--Linktooltip popover--bottom is-active'>
18
+ <div class='popover-inner'>
19
+ <a href='#' target='_blank'> Link </a>
20
+ </div>
21
+ <div class='popover-arrow'>
22
+ </div>
23
+ </div>"
24
+
25
+ #display & copy original link
26
+ positionAt: (ev)->
27
+ target = $(ev.currentTarget)
28
+ target_positions = @resolveTargetPosition(target)
29
+ target_offset = target.offset()
30
+ target_width = target.outerWidth()
31
+ target_height = target.outerHeight()
32
+ popover_width = $(@el).find(".popover").outerWidth()
33
+ top_value = target_positions.top + target_height
34
+ left_value = target_offset.left + (target_width/2) - (popover_width/2)
35
+
36
+ $(@el).find(".popover")
37
+ .css("top", top_value)
38
+ .css("left", left_value )
39
+ .show()
40
+
41
+ @handleDirection(target)
42
+
43
+ displayAt: (ev)->
44
+ @cancelHide()
45
+ #debugger
46
+ target = $(ev.currentTarget)
47
+ $(@el).find(".popover-inner a").text( target.attr('href') ).attr('href', target.attr("href") )
48
+ @positionAt(ev)
49
+ $(@el).find(".popover--tooltip").css("pointer-events", "auto")
50
+ $(@el).show()
51
+
52
+ cancelHide: ()->
53
+ utils.log "Cancel Hide"
54
+ clearTimeout @hideTimeout
55
+
56
+ hide: (ev)->
57
+ @cancelHide()
58
+ @hideTimeout = setTimeout ()=>
59
+ $(@el).find(".popover").hide()
60
+ , @settings.timeout
61
+
62
+ resolveTargetPosition: (target)->
63
+ if target.parents(".graf--mixtapeEmbed").exists()
64
+ target.parents(".graf--mixtapeEmbed").position()
65
+ else
66
+ target.position()
67
+
68
+
69
+ handleDirection: (target)->
70
+ if target.parents(".graf--mixtapeEmbed").exists()
71
+ $(@el).find(".popover").removeClass("popover--bottom").addClass("popover--top")
72
+ else
73
+ $(@el).find(".popover").removeClass("popover--top").addClass("popover--bottom")
74
+
75
+ render: ()->
76
+ $(@template()).insertAfter(@editor.$el)
@@ -4,4 +4,5 @@
4
4
  //= require dante/view
5
5
  //= require dante/editor
6
6
  //= require dante/tooltip
7
+ //= require dante/popover
7
8
  //= require dante/menu
@@ -0,0 +1,52 @@
1
+ .imageCaption {
2
+ & {
3
+ position: absolute;
4
+ left: -172px;
5
+ width: 150px;
6
+ top: 0;
7
+ text-align: right;
8
+ margin-top: 0;
9
+ font-family: "freight-text-pro",Georgia,Cambria,"Times New Roman",Times,serif;
10
+ letter-spacing: 0.01rem;
11
+ font-weight: 400;
12
+ font-style: italic;
13
+ font-size: 14px;
14
+ line-height: 1.4;
15
+ color: rgba(0,0,0,0.6);
16
+ outline: 0;
17
+ z-index: 300;
18
+ }
19
+ &:before {
20
+ width: 25%;
21
+ margin-left: 75%;
22
+ border-top: 1px solid rgba(0,0,0,0.15);
23
+ display: block;
24
+ content: "";
25
+ margin-bottom: 10px;
26
+ }
27
+ }
28
+ @media (max-width: 1200px) {
29
+ .imageCaption,
30
+ .postField--outsetCenterImage > .imageCaption {
31
+ position: relative;
32
+ width: 100%;
33
+ text-align: center;
34
+ left: 0;
35
+ margin-top: 10px;
36
+ }
37
+ .imageCaption:before {
38
+ display: none;
39
+ }
40
+ }
41
+
42
+ figure.is-defaultValue .imageCaption,
43
+ .graf--sectionCaption.is-defaultValue {
44
+ display: none;
45
+ }
46
+
47
+ .graf--figure.is-mediaFocused .imageCaption,
48
+ .graf--figure.is-defaultValue.is-selected .imageCaption,
49
+ section.is-mediaFocused .graf--sectionCaption,
50
+ .graf--sectionCaption.is-defaultValue.is-selected {
51
+ display: block;
52
+ }