These are chat archives for GetmeUK/ContentTools

Oct 2016
Eeliya Rasta
Oct 24 2016 07:16 UTC
Hi @anthonyjb , hope you are doing fine.
Is there any chance that you rewrite ContentTools in TypeScript? :D I know it's big task, but if you do I would be happy to help. I'm using your awesome editor in my CMS(a very old version of ContentTools) and I made many changes and integrated into my CMS. One of the biggest challenge that I faced so far was the singleton nature of the editor which is kind of a issue in my web application (or an application in general).
I can't give you a good reason to move to TypeScript except some improvements and even better code structure.
Please let me know about your future plans for ContentTools :)
Anthony Blackshaw
Oct 24 2016 11:01 UTC

Hi @Eeliya,

So thanks for getting in touch to discuss this. There's really a couple of issues you've raised here, TypeScript and the singleton pattern, so I'll do my best to answer both with regard ContentTools and decisions being made.

I've been honest with my answers but that doesn't mean they are correct and I'm certainly not suggesting your requests are incorrect, they just don't fit with the plan for CT.

On the topic of moving to TypeScript. This isn't going to happen, baring some unforeseen change/event (which aren't all that rare in web development) we will be sticking with CoffeeScript. Not because CoffeeScript is perfect but because long term I don't believe that JavaScript will be the only language available in all major browsers and only at the point that there are other language options am I likely to reevaluate the underlying language for CT. Transpilers aren't the solution, they're a plaster and there popularity a statement about the way the community would like to see a language progress. I've nothing against TypeScript but the real gain CT will get from moving to a different programming language would be to move to a non-transpiled one, such as ES6 (I'm just not that enamoured with ES6 so want to see what options appear in the next few years).

CoffeeScript will remain because it's what we use in-house at Getme and whilst I develop in a lot of languages over the course of any given 12 months you'll see I tend to use those languages with indent based structure (all of my largest projects are currently developed in Python, CoffeeScript or MoonScript).

I realize this is a love/hate issue for many - but for me personally I read/write code quicker in the languages I just mentioned - and we all have a limited amount of time and a lot we want to achieve :)

With regard to singletons, this was a design decision made when we redeveloped CT based on what we felt was the simplest interface for the majority of cases - and for the majority of cases I think this was right.

We have 2 true singleton classes (ContentTools.EditorApp and ContentEdit.Root) but I more commonly use static classes (e.g Tools, Styles) over the singleton instance pattern (so there are quite a few CT interface that in some way fit this pattern).

There has been an attempt to implement these classes without using the singleton pattern, and instead using factories (the relevant PRs are here: here: Unfortunately I felt this approach was too much of a shift at least for release 1..). This is still an open issue and I'd like to look at supporting multiple editor and root instances using a context stack instead before release 2.0.0 because I believe this could be implemented without affecting the libraries API (and breaking other peoples projects using CT). A context stack it's not the most pure of approaches (by some way) but at this point is perhaps the most practical.

Eeliya Rasta
Oct 24 2016 13:21 UTC
Thanks @anthonyjb for sharing your thoughts :)