123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- 'use strict';
- define(['underscore', '../../../lib/@waca/dashboard-common/dist/ui/WidgetBase'], function (_, WidgetBase) {
-
- var StaticWidget = WidgetBase.extend({
- focusOn: false,
- init: function init() {
- StaticWidget.inherited('init', this, arguments);
- },
- onContainerReady: function onContainerReady() {
- StaticWidget.inherited('onContainerReady', this, arguments);
- },
-
- onChromeSelected: function onChromeSelected() {
- StaticWidget.inherited('onChromeSelected', this, arguments);
- this.onFocus();
- },
-
- onChromeDeselected: function onChromeDeselected() {
- StaticWidget.inherited('onChromeDeselected', this, arguments);
- this.focusOn = false;
- },
-
- onFocus: function onFocus() {
- if (!this.focusOn) {
- this.focusOn = true;
- }
- },
-
- getHtmlRender: function getHtmlRender() {
- return null;
- },
-
- getWidgetStyleNode: function getWidgetStyleNode() {
- return this.$el.children('.staticContent');
- },
-
- onPropertyUpdate: function onPropertyUpdate() {
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- StaticWidget.inherited('onPropertyUpdate', this, arguments);
-
- this.updateModelContent(null, options.transactionId, options.sender);
- },
-
- updateModelContent: function updateModelContent(updatedHtml, transactionId) {
-
- if (!updatedHtml) {
- updatedHtml = this.getHtmlRender();
- }
-
- var data = {};
- if (transactionId) {
- _.extend(data, {
- payloadData: {
- undoRedoTransactionId: transactionId
- }
- });
- } else {
- _.extend(data, {
- silent: true
- });
- }
- this.set({
- content: updatedHtml
- }, data);
- }
- });
- return StaticWidget;
- });
|