Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cvasseng committed Dec 7, 2016
1 parent b5b7d41 commit e2ef5e8
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 14 deletions.
3 changes: 2 additions & 1 deletion integrations/ckeditor.js

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

3 changes: 2 additions & 1 deletion integrations/tinymce.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ tinymce.PluginManager.add('highcharts', function (editor, url) {
var modal = highed.ModalEditor(false, {
features: 'import templates customize welcome done',
allowDone: true
}, function (html) {
}, function (chart) {
var html = chart.export.html(true);
editor.insertContent('<div class="mceNonEditable">' + html + '</div><p></p>');
})
;
Expand Down
3 changes: 2 additions & 1 deletion integrations/wordpress/highcharts-editor/editor_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ tinymce.PluginManager.add('highcharts', function (editor, url) {
var modal = highed.ModalEditor(false, {
features: 'import templates customize welcome done',
allowDone: true
}, function (html) {
}, function (chart) {
var html = chart.export.html(true);
editor.insertContent('<div class="mceNonEditable">' + html + '</div><p></p>');
})
;
Expand Down
46 changes: 37 additions & 9 deletions src/editors/highed.editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* > importer {object} - options passed to the contained importer object (see highed.DataImporter)
* > exporter {object} - options passd to the contained export object (see highed.DataExporter)
* > availableSettings {array} - array containing a whitelist of editable properties. Default is "show all available"
* > useContextMenu {boolean} - enable/disable gear icon in header
* > useHeader {boolean} - enable/disable the header
* @return {highed.Editor} - A new instance of an editor
*/
highed.Editor = function (parent, attributes) {
Expand All @@ -157,16 +159,21 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
defaultChartOptions: {},
on: {},
plugins: {},
features: 'import export templates customize',
events: {},
features: 'welcome import export templates customize',
includeSVGInHTMLEmbedding: true,
importer: {},
exporter: {},
availableSettings: false
availableSettings: false,
useContextMenu: true,
useHeader: true
}, attributes),

container = highed.dom.cr('div', 'highed-container'),
expandContainer = highed.dom.cr('div', 'highed-expand-container'),

wizbody = highed.dom.cr('div'),

mainToolbar = highed.Toolbar(container, {
additionalCSS: ['highed-header']
}),
Expand Down Expand Up @@ -205,13 +212,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
doneBtn = highed.dom.cr('div', 'highed-ok-button', highed.getLocalizedStr('doneCaption')),
doneStep = wizbar.addStep({title: highed.getLocalizedStr('stepDone')}),


chartIcon = highed.dom.cr('div', 'highed-chart-container-icon'),

cmenu = highed.DefaultContextMenu(chartPreview)

;



cmenu.on('NewChart', function () {
dataImpStep.activate();
});
Expand Down Expand Up @@ -275,6 +283,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
wb = highed.dom.size(wizbar.container)
;

if (!properties.useHeader) {
ms = {
w: 0,
h: 0
};
}

//wizbar.resize(undefined, cs.h - ms.h - wb.h);
chartCustomizer.resize(undefined, cs.h - ms.h - wb.h);
chartTemplateSelector.resize(undefined, cs.h - ms.h - wb.h);
Expand Down Expand Up @@ -466,19 +481,32 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
}
});

mainToolbar.addIcon({
css: 'fa-gear',
click: function(e) {
cmenu.show(e.clientX, e.clientY);
}
});
if (properties.useContextMenu) {
mainToolbar.addIcon({
css: 'fa-gear',
click: function(e) {
cmenu.show(e.clientX, e.clientY);
}
});
}

updateToolbarIcon();

highed.ready(function () {
window.scrollTo(0, 1);
});

if (!properties.useHeader) {
highed.dom.style(mainToolbar.container, {
display: 'none'
});
}

Object.keys(properties.events).forEach(function (k) {
if (highed.isFn(properties.events[k])) {
events.on(k, properties.events[k]);
}
});

chartPreview.on('RequestResize', resize);

Expand Down
2 changes: 1 addition & 1 deletion src/editors/highed.modaleditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ highed.ModalEditor = function (summoner, attributes, fn) {

function doDone() {
if (highed.isFn(fn)) {
fn(editor.chart.export.html(true), editor.chart.export.svg());
fn(editor.chart);
}
modal.hide();
}
Expand Down
3 changes: 2 additions & 1 deletion views/modal.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
importer: {
options: 'plugins csv json samples'
}
}, function (html) {
}, function (chart) {
var html = chart.export.html(true);
highed.dom.get('chart-result').value = html;
});
});
Expand Down

0 comments on commit e2ef5e8

Please sign in to comment.