Skip to content

Commit

Permalink
Merge branch 'master' of 50.112.103.113:sqlabs
Browse files Browse the repository at this point in the history
  • Loading branch information
oshikiri committed Jun 11, 2012
2 parents 3703add + 9b0b025 commit 7132797
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
26 changes: 23 additions & 3 deletions static/plugin_smarteditor_widget/smarteditor_models.akamon.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
BROWSER_IS_IE = document.uniqueID?

# IEの時、編集状態の判定を上書きする
if BROWSER_IS_IE
SmartEditor.elementTests.isEditable = (el, test_results) ->
t = $(el).closest(".managed_html_content_block.editing")
f = $(el).closest(".managed_html_content_block.disable_editing")

if f.length == 0
return t.length > 0

if t.length > 0
return t.find(f).length == 0

false



class ManagedHTMLModel extends SmartEditor.ElementModel

defaults:
Expand All @@ -17,7 +35,8 @@ class ManagedHTMLModel extends SmartEditor.ElementModel
'publish': {type: 'Action', title:'公開', disabled:true}
'history': {type: 'Action', title:'履歴', disabled:true}
'loading': {type: 'Loading', message: '<div class="managed_html_spinner" style="width:100%;top:12px;left:10px;position:absolute;"></div>'}



class ManagedHTMLView extends SmartEditor.ElementView
initialize: ->
super
Expand All @@ -38,7 +57,7 @@ class ManagedHTMLView extends SmartEditor.ElementView
if @$el.hasClass('managed_html_content_block_pending') and $('#'+@el.form_id).length == 0
@model.schema.publish.disabled = false

if 0 != @$el.closest("div[contenteditable=true][id!="+@el.id+"]").length and 0 != @$el.closest(".handlebars_content_block").find('.managed_html_content_inner').length
if 0 != this.$el.parent().closest('.editing').length
@model.schema[name].disabled = true for name in ['edit','history', 'back', 'commit', 'insert', 'html_editor']
@model.schema[name].disabled = false for name in ['insert', 'html_editor', 'delete']

Expand Down Expand Up @@ -139,7 +158,8 @@ class ManagedHTMLView extends SmartEditor.ElementView
'loading': false
'locked': false

$("*:not(.managed_html_content_block .managed_html_content_inner, .managed_html_content)",@$el).attr "contenteditable", true
if ! BROWSER_IS_IE
$("*:not(.managed_html_content_block .managed_html_content_inner, .managed_html_content)",@$el).attr "contenteditable", true
@$el.addClass('editing')

# 入れ子のhandlebars要素の編集禁止
Expand Down
21 changes: 18 additions & 3 deletions static/plugin_smarteditor_widget/smarteditor_models.akamon.js

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

0 comments on commit 7132797

Please sign in to comment.