From 632dd68a2fcf03f06eada833175dff5fe6595065 Mon Sep 17 00:00:00 2001 From: Matthew Borden Date: Tue, 8 Jul 2014 16:10:57 +1000 Subject: [PATCH] Working: Editor Functionality, testing function call on object --- ui/Squire-UI.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/Squire-UI.js b/ui/Squire-UI.js index 1b71b90..9908769 100644 --- a/ui/Squire-UI.js +++ b/ui/Squire-UI.js @@ -29,10 +29,16 @@ $(document).ready(function () { $(div).load(buildPath + 'Squire-UI.html', function () { $('.item').click(function () { var me = $(this); + var iFrame = me.parents('.Squire-UI').next('iframe').first()[0]; - var editor = iFrame.contentWindow.document; - var action = me.data('action'); - console.log(editor, action); + editor = iFrame.contentWindow.document; + console.log(me.data('action'), me.data('value')); + try { + editor[me.data('action')](me.data('value')); + } catch (error) { + console.log(error); + } + }); });