Skip to content

Support different HTML for view and edit mode #2

@ldubost

Description

@ldubost

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions