| Summary: | [client] Be able to open /coding.html in the read-only mode | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Szymon Brandys <Szymon.Brandys> |
| Component: | Client | Assignee: | Susan McCourt <susan> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | aniefer, Silenio_Quarti, simon_kaegi, susan |
| Version: | 0.2 | ||
| Target Milestone: | 0.2 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 334213 | ||
|
Description
Szymon Brandys
It would be good to have it fixed in m7. Otherwise users may try to save/edit the commit content what causes errors in the console. Silenio, could you look at it during M8? The editor widget supports read-only mode already. Changes have to done on top of the editor to expose this feature (probably in editorContainer.js). The original request was to change coding.html to accept a read-only parameter in the URI somehow, but I believe it has been decided that coding.html is not consumable. Some work was done in editorContainer to make it more consumable (bug#337647). Susan, was this addressed as part of that bug? The underpinnings are all there, what we need is either a flag in the URI or a separate read-only page. There are things we would want to disable at the page level (such as the save command), as well as setting the property in the editor. I'll figure out which makes sense. After looking at the code, I opted for a separate html file. To edit a file: http://localhost:8080/edit/edit.html#/file/A/static/edit/edit.js To view a file: http://localhost:8080/edit/readonly.html#/file/A/static/edit/edit.js This lets us remove scripts that won't be used at all (such as content assist, etc.) and prevents polluting all the hash checking with something that only needs to be known once up front. The "glue" code is now parameterized to readOnly so that it does not have to be maintained in two places. cc'ing Simon because I ended up copying "edit.css" to "readonly.css". This seemed kind of dumb but you wanted "one css file for each html file" so I supposed this should be done. If this was the wrong decision, please advise. cc'ing Andrew because I ended up adding a script tag in edit.html in HEAD but after the <!-- INSERT:coding-editor.js --> I assume this will do the right thing. I want the call in HEAD because it parameterizes the glue. We should decide if we want to optimize the building of the readonly.html. For now I assumed we would not. (In reply to comment #5) > cc'ing Simon because I ended up copying "edit.css" to "readonly.css". This > seemed kind of dumb but you wanted "one css file for each html file" so I > supposed this should be done. If this was the wrong decision, please advise. Discussed with Simon. For now this is the right decision. We'll have one css per html file and later if we decide to optimize for identical content, we can. > > cc'ing Andrew because I ended up adding a script tag in edit.html in HEAD but > after the <!-- INSERT:coding-editor.js --> Talked to Simon about this. I had a js one-liner in the script tag rather than making the js one-liner its one file. This is a no-no and won't work correctly with require.js. So I changed the files again. - rename parameterized glue code from edit.js to setup.js - create glue code one-liners edit.js and readonly.js, which call the function in setup.js - added setup.js to the closure.xml file for the editor case |