Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/transactions/behavior-comment-actions.js
| Show First 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | function onresponse(response) { | ||||
| if (JX.Device.getDevice() != 'desktop') { | if (JX.Device.getDevice() != 'desktop') { | ||||
| return; | return; | ||||
| } | } | ||||
| var panel = JX.$(config.panelID); | var panel = JX.$(config.panelID); | ||||
| if (!response.xactions.length) { | if (!response.xactions.length) { | ||||
| JX.DOM.hide(panel); | JX.DOM.hide(panel); | ||||
| } else { | } else { | ||||
| var preview_root = JX.$(config.timelineID); | |||||
| JX.DOM.setContent( | JX.DOM.setContent( | ||||
| JX.$(config.timelineID), | preview_root, | ||||
| [ | [ | ||||
| JX.$H(response.xactions.join('')), | JX.$H(response.xactions.join('')), | ||||
| JX.$H(response.previewContent) | JX.$H(response.previewContent) | ||||
| ]); | ]); | ||||
| JX.DOM.show(panel); | JX.DOM.show(panel); | ||||
| // NOTE: Resonses are currently processed before associated behaviors are | |||||
| // registered. We need to defer invoking this event so that any behaviors | |||||
| // accompanying the response are registered. | |||||
| var invoke_preview = function() { | |||||
| JX.Stratcom.invoke( | |||||
| 'EditEngine.didCommentPreview', | |||||
| null, | |||||
| { | |||||
| rootNode: preview_root | |||||
| }); | |||||
| }; | |||||
| setTimeout(invoke_preview, 0); | |||||
| } | } | ||||
| } | } | ||||
| JX.DOM.listen(form_node, ['submit', 'didSyntheticSubmit'], null, function() { | JX.DOM.listen(form_node, ['submit', 'didSyntheticSubmit'], null, function() { | ||||
| input_node.value = serialize_actions(); | input_node.value = serialize_actions(); | ||||
| }); | }); | ||||
| if (config.showPreview) { | if (config.showPreview) { | ||||
| ▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines | |||||