Open ashwinkjoseph opened 4 years ago
shiva and emily are working on this
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
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
mount
).style
which should have the logic for applying the styles to the editor's container as well as to the editor itself based on the received input and the options available in acetype
save it in the editor's sate asonSwitch
.persistContent
which would have the logic to save the content in localStorage with the id with which the editor was instantiatedgetContent
which would retrieve the content from the ace editor and return as a formatted string (we need to agree upon this format, it's not decided yet)minimize
which would make the container div element of the editor invisible (display:none
) and call theonSwitch
method with value as 'minimize'close
which would remove the values stored in localStorage and destroy the instance of the editor and call theonSwitch
method with the value as 'close'