These are chat archives for GetmeUK/ContentTools

9th
Oct 2015
Anthony Blackshaw
@anthonyjb
Oct 09 2015 08:32
Hi @bfintal - so it's easy to create a dialog either by inheriting from the PropertiesDialog class and then extending it's behaviour or by creating your own from scratch by inheriting from the base Dialog class (and using the existing dialogs as a guide). If you're adding say a new tab then this should be pretty easy especially if it uses switches, or key/pair components which already exist - if you're planning on custom components then you'll need to add SASS to support them and of course write the some code to support their mounting and behaviour.
Benjamin Intal
@bfintal
Oct 09 2015 09:36
I feel like I'm bugging you all the time haha
Anthony Blackshaw
@anthonyjb
Oct 09 2015 18:13
@bfintal It's usually easier to use chat to discuss stuff - was out all day unfortunately but around over the weekend if I can help with the dialog stuff - btw hows your wordpress plugin going?
Benjamin Intal
@bfintal
Oct 09 2015 21:18
I'm trying some stuff
The hard thing is that you don't know what's content being edited beforehand
The plugin I'm creating allows you to edit your site's content from the frontend, hence the need for ContentTools
I want to get your thoughts on where I'm at right now. I'm adding a toolbar in the editable content, separate from CT
Benjamin Intal
@bfintal
Oct 09 2015 21:29
So the set up is that every webpage has a specified area that's only editable. CT is used to on that area to modify the content. There are also other stuff that can be performed by the plugin, such as added specific classes to different dom elements. For that part, I'm building a toolbar system separate from CT. So what happens is that when you hover your mouse over an element, this other toolbar would appear. The toolbar now contains buttons that use CT objects and methods to change the content.
such as adding*
I can find what's being hovered on easily using Javascript. However, is there a way to use dom elements to find out their specific CT Nodes?
Benjamin Intal
@bfintal
Oct 09 2015 21:43
I mean aside from looping through all the regions and elements
Anthony Blackshaw
@anthonyjb
Oct 09 2015 22:27
hey
@bfintal so you need to know which element the mouse is currently over not focused, do you need to know this when the editor is editing or when it's ready (e.g showing the pencil icon)?
Benjamin Intal
@bfintal
Oct 09 2015 22:34
Actually, it might be easier to explain by code (which oddly almost never happens in my experience). I'm using this function to find the CT Element from a dom element inside the editor https://gist.github.com/bfintal/8567f227bf0d9e7ab0f4
Anthony Blackshaw
@anthonyjb
Oct 09 2015 22:36
right so that's a reverse look up function based on the DOM element right? So are you calling that whenever the user hovers over a relevant DOM element in the page?
Benjamin Intal
@bfintal
Oct 09 2015 22:47
Yup! I'm using that so that I can use also the functions from CT to apply changes, detach nodes, etc
Anthony Blackshaw
@anthonyjb
Oct 09 2015 22:47
ok I think I can give you a far simpler mechanism, just testing it out - 2 minutes
OK I've posted a possibly improved approach against your gist.
Benjamin Intal
@bfintal
Oct 09 2015 23:05
Great suggestion, I'm checking the docs for those events. I bet I can use some of those to lessen some loops in my own code. I'm slowly getting the hang of how everything in CT works. :)