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

Support different HTML for view and edit mode #2

Open
ldubost opened this issue Feb 1, 2015 · 0 comments
Open

Support different HTML for view and edit mode #2

ldubost opened this issue Feb 1, 2015 · 0 comments

Comments

@ldubost
Copy link
Member

ldubost commented Feb 1, 2015

It would be nice to support different HTML for view and edit mode. This is necessary for the svgedit webviewer has we want to use completely different code in both cases.

This code in WebViewers.Code would work:

private Map doZip(xcontext, doc, fileName, out) {
    def j = new JsonSlurper().parseText(getPkg(doc, fileName, xcontext));
    def actions = j.get("actions");
    def main = j.get("main");
    def main_view = j.get("main_view");
    def main_edit = j.get("main_edit");
    if (!main) { main = "index.html"; }
    if (!main_view) { main_view = main; }
    if (!main_edit) { main_edit = main; }
    for (Object action : actions.keySet()) {
        for (Object fileType : actions.get(action)) {
            def hm = out.get(fileType);
            if (!hm) {
                hm = new HashMap();
                out.put(fileType, hm);
            }
            def mainpath = (action=="edit") ? main_edit : main_view;
            hm.put(action, URLDecoder.decode(doc.getAttachmentURL(fileName), "UTF-8") + "/" + mainpath);
        }
    }
    return out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant