The-Programming-Foundation / learningcodesnippets

This repo consists of all the code snippets for the Learning section of the website
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Implement editor class using c9's ace #9

Open ashwinkjoseph opened 4 years ago

ashwinkjoseph commented 4 years ago

Task Description Implement the abstract class for editor using C9's ace editor

In the context of TPF, an editor should have the following behaviour:

Acceptance criteria for task

ashwinkjoseph commented 4 years ago

shiva and emily are working on this

yu-emily commented 3 years ago

This is the most basic implementation I have right now. I'm not too sure on the parameters for the class constructor, so I have the constructor now with 3 parameters: (1) the div element, (2) the options for styling the editor (if provided), and (3) the unique id (if provided).

For the acceptance criteria, I'm not too clear on this one: Should accept a callback function during initialization which would accept the parameter type save it in the editor's sate as onSwitch. It accepts a parameter "type" and saves it as a onSwitch state, but for both minimize and close, we'll call the onSwitch method with a value. I think what's confusing for me is, is onSwitch supposed to be a property or method. For now, I have a dummy function called onSwitch outside the class and is included in the implementation example: https://github.com/yu-emily/TPF/blob/8b8190c25bee24acd353468f82d10b4c29947dd7/aceEditor.js#L89-L92

The code for the implementation is as follows. https://github.com/yu-emily/TPF/blob/8b8190c25bee24acd353468f82d10b4c29947dd7/aceEditor.js#L1-L111