Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create iterateBlock method #48

Closed
n0str opened this issue Jun 24, 2016 · 1 comment
Closed

Create iterateBlock method #48

n0str opened this issue Jun 24, 2016 · 1 comment
Assignees
Milestone

Comments

@n0str
Copy link
Member

n0str commented Jun 24, 2016

It iterates blocks and calls save() method of each entry.
Then it builds final JSON and moves to the database.

@n0str n0str added this to the 1.1.1 milestone Jun 24, 2016
@n0str n0str self-assigned this Jun 24, 2016
@neSpecc
Copy link
Member

neSpecc commented Jun 24, 2016

Начало заложено в #52

/**
* Methods for parsing JSON reactor data to HTML blocks
*/
cEditor.renderer = {

    /**
    * Asyncronously parses input JSON to redactor blocks
    */
    makeBlocksFromData : function (argument) {

        console.info('renderer makeBlocksFromData');

        Promise.resolve()

                        /** First, get JSON from state */
                        .then(function() {
                            return cEditor.state.blocks;
                        })

                        /** Then, start to iterate they */
                        .then(cEditor.renderer.appendBlocks)

                        /** Write log if something goes wrong */
                        .catch(function(error) {
                            cEditor.core.log('Error while parsing JSON: %o', 'warn', error);
                        });

    },

    /**
    * Parses JSON to blocks
    * @param {object} data
    * @return Primise -> nodeList
    */
    appendBlocks : function (data) {

        console.info('renderer appendBlocks %o', data);

        /**
        * Тут надо создать очередь по аналогии с parser.appendNodesToRedactor,
        * которая будет асинхронно парсить блоки с помощью метода render у каждого плагина
        */

    },

}

/**
* Methods for saving HTML blocks to JSON object
*/
cEditor.saver = {

    /**
    * Saves blocks
    */
    saveBlocks : function (argument) {

        console.info('saver saveBlocks');

    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants