Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/plugins/oer/assorted/lib/image.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ define [
) ->

# This will be prefixed with Aloha.settings.baseUrl
WARNING_IMAGE_PATH = '/../plugins/oer/image/img/warning.png'
WARNING_IMAGE_PATH = '/../plugins/oer/assorted/img/warning.png'

DIALOG_HTML_CONTAINER = '''
<form class="plugin image modal hide fade form-horizontal" id="linkModal" tabindex="-1" role="dialog" aria-labelledby="linkModalLabel" aria-hidden="true" data-backdrop="false" />'''
Expand Down Expand Up @@ -268,6 +268,9 @@ define [
deferred.reject()
dialog.modal('hide')

dialog.on 'hidden', () ->
deferred.reject()

dialog.modal {show: true}

return deferred.promise()
Expand Down Expand Up @@ -388,11 +391,13 @@ define [
return deferred.promise()

insertImage = () ->
Figure.insertPlaceholder()
marker = Figure.insertPlaceholder()

showCreateDialog().then (image) ->
Figure.insertOverPlaceholder(image)
Figure.insertOverPlaceholder(image, marker)
showModalDialog2(image)
.fail () ->
marker.remove()

$('body').bind 'aloha-image-resize', ->
Aloha.activeEditable.smartContentChange({type: 'block-change'})
Expand Down
15 changes: 10 additions & 5 deletions src/plugins/oer/assorted/lib/image.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/plugins/oer/figure/lib/figure-plugin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ define [
selector: 'figure'
insertPlaceholder: ->
semanticBlock.insertPlaceholder()
insertOverPlaceholder: ($content) ->
insertOverPlaceholder: ($content, $placeholder) ->
$figure = $('<figure>')
.append('<div class="title">')
.append($content)
.append('<figcaption>')

semanticBlock.insertOverPlaceholder($figure)
semanticBlock.insertOverPlaceholder($figure, $placeholder)
init: () ->
plugin = @
semanticBlock.register(plugin)
Expand Down
7 changes: 3 additions & 4 deletions src/plugins/oer/figure/lib/figure-plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 22 additions & 5 deletions src/plugins/oer/media-embed/lib/media-embed-plugin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ define [

embed = Plugin.create 'mediaEmbed',

placeholder: null # Keep track of an inserted place holder

ignore: '[data-type="title"],[data-type="alternates"],.noembed-embed,.noembed-embed *'

create: (thing) =>
create: (thing) ->
$thing = $(TEMPLATE)

$thing.find('[data-type="title"]').text(thing.title)
Expand All @@ -91,7 +93,8 @@ define [
$thing.find('[data-type="alternates"]').html(thing.html)

$caption = $thing.find('figcaption').remove()
$figure = Figure.insertOverPlaceholder($thing.contents())
$figure = Figure.insertOverPlaceholder($thing.contents(), @placeholder)
@placeholder = null

$figure.find('figcaption').find('.aloha-editable').html($caption.contents())

Expand All @@ -110,12 +113,12 @@ define [

$dialog.find('input[name="figureTitle"]').val(thing.title) if thing.title

$dialog.find('.cancel').off('click').click (e) ->
$dialog.find('.cancel').off('click').on 'click', (e) ->
e.preventDefault(true)
$dialog.modal 'hide'
embed.showDialog()

$dialog.find('.embed').off('.embed').click (e) ->
$dialog.find('.embed').off('.embed').on 'click', (e) ->
e.preventDefault(true)
$dialog.modal 'hide'
embed.create
Expand All @@ -124,6 +127,13 @@ define [
author: thing.author
authorUrl: thing.authorUrl

$dialog.find('[data-dismiss]').on 'click', (e) ->
embed.placeholder.remove()
embed.placeholder = null
$dialog.on 'keyup.dismiss.modal', (e) =>
if e.which == 27
@placeholder.remove()
@placeholder = null
$dialog.modal {show: true}

embedByUrl: (url) =>
Expand Down Expand Up @@ -173,6 +183,13 @@ define [
.fail ->
$dialog.find('.text-error').show()

$dialog.find('[data-dismiss]').on 'click', (e) =>
@placeholder.remove()
@placeholder = null
$dialog.on 'keyup.dismiss.modal', (e) =>
if e.which == 27
@placeholder.remove()
@placeholder = null
$dialog.modal 'show'

init: () ->
Expand All @@ -184,7 +201,7 @@ define [
# For legacy toolbars
UI.adopt "insertMediaEmbed", Button,
click: =>
Figure.insertPlaceholder()
@placeholder = Figure.insertPlaceholder()
@showDialog()

semanticBlock.register(this)
Expand Down
33 changes: 27 additions & 6 deletions src/plugins/oer/media-embed/lib/media-embed-plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/plugins/oer/semanticblock/css/semanticblock-plugin.css
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,8 @@
.aloha-oer-block .aloha-editable {
min-height: 20px;
}

.oer-placeholder:before {
content: url(../img/insert-here-arrow.png);
opacity: 0.25;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions src/plugins/oer/semanticblock/lib/semanticblock-plugin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,12 @@ define ['aloha', 'block/block', 'block/blockmanager', 'aloha/plugin', 'aloha/plu
refreshPositions: true

insertPlaceholder: ->
$('.oer-placeholder').remove()

placeholder = $('<span class="aloha-ephemera oer-placeholder"></span>')
range = Aloha.Selection.getRangeObject()
GENTICS.Utils.Dom.insertIntoDOM $('<span class="aloha-ephemera oer-placeholder"></span>'), range, Aloha.activeEditable.obj
GENTICS.Utils.Dom.insertIntoDOM placeholder, range, Aloha.activeEditable.obj
return placeholder

insertOverPlaceholder: ($element, $placeholder) ->
$placeholder = $('.oer-placeholder') if not $placeholder?.length

$element.addClass 'semantic-temp'
$placeholder.replaceWith($element)
$element = Aloha.jQuery('.semantic-temp').removeClass('semantic-temp')
Expand Down
12 changes: 5 additions & 7 deletions src/plugins/oer/semanticblock/lib/semanticblock-plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.