{"action":"created","issue":{"url":"https://api.github.com/repos/kogmbh/WebODF/issues/857","labels_url":"https://api.github.com/repos/kogmbh/WebODF/issues/857/labels{/name}","comments_url":"https://api.github.com/repos/kogmbh/WebODF/issues/857/comments","events_url":"https://api.github.com/repos/kogmbh/WebODF/issues/857/events","html_url":"https://github.com/kogmbh/WebODF/pull/857","id":53279787,"number":857,"title":"Support modified/unmodified state with documents","user":{"login":"kossebau","id":4068037,"avatar_url":"https://avatars.githubusercontent.com/u/4068037?v=3","gravatar_id":"","url":"https://api.github.com/users/kossebau","html_url":"https://github.com/kossebau","followers_url":"https://api.github.com/users/kossebau/followers","following_url":"https://api.github.com/users/kossebau/following{/other_user}","gists_url":"https://api.github.com/users/kossebau/gists{/gist_id}","starred_url":"https://api.github.com/users/kossebau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kossebau/subscriptions","organizations_url":"https://api.github.com/users/kossebau/orgs","repos_url":"https://api.github.com/users/kossebau/repos","events_url":"https://api.github.com/users/kossebau/events{/privacy}","received_events_url":"https://api.github.com/users/kossebau/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-02T21:39:54Z","updated_at":"2015-01-02T21:42:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kogmbh/WebODF/pulls/857","html_url":"https://github.com/kogmbh/WebODF/pull/857","diff_url":"https://github.com/kogmbh/WebODF/pull/857.diff","patch_url":"https://github.com/kogmbh/WebODF/pull/857.patch"},"body":"When editing a copy of a document in the editor it is useful to know which state of the document in the editor matches the state that has been synched to some storage.\r\nE.g. to know when to warn users on leaving the page that changes will be lost.\r\n\r\nFor Wodo.TextEditor this API extension is proposed:\r\n```\r\nsetDocumentUnmodified(): undefined\r\nisDocumentModified(): boolean\r\nEVENT_MODIFIEDCHANGED: modified: boolean\r\n```\r\nwhere `setDocumentUnmodified()` sets the current state of the document to be the unmodified state. When loading a document, the initial state of a document is set to be the unmodified state.\r\nBut this API does not allow to remove the unmodified state from the document. Which might be a failure. E.g. when loading a generated document, one might want to have the document modified from the begin.\r\n\r\nAnother API might be:\r\n```\r\nsetDocumentModified(modified:boolean): undefined\r\nisDocumentModified(): boolean\r\nEVENT_MODIFIEDCHANGED: modified: boolean\r\n```\r\nwhere `setDocumentModified(true)` would unset the current state from unmodified if it is, but not clear the unmodified flag from any other document state. So meanwhile think this is better. What do you think?\r\n\r\nAs the UndoManager has direct control about the state, it seemed like a good idea to extend the API for this ability and demand implementations to care about that. Not sure yet if that logic can be generalized into a separate utility class, for now the code directly inside TrivialUndoManager was simpler to do at least. For editors without an undomanager a fallback solution is still needed.\r\n\r\n- [x] Code draft \r\n- [x] extend examples\r\n- [ ] Unit tests\r\n- [ ] document usage in tutorials"},"comment":{"url":"https://api.github.com/repos/kogmbh/WebODF/issues/comments/68565156","html_url":"https://github.com/kogmbh/WebODF/pull/857#issuecomment-68565156","issue_url":"https://api.github.com/repos/kogmbh/WebODF/issues/857","id":68565156,"user":{"login":"kogmbh-ci","id":5606163,"avatar_url":"https://avatars.githubusercontent.com/u/5606163?v=3","gravatar_id":"","url":"https://api.github.com/users/kogmbh-ci","html_url":"https://github.com/kogmbh-ci","followers_url":"https://api.github.com/users/kogmbh-ci/followers","following_url":"https://api.github.com/users/kogmbh-ci/following{/other_user}","gists_url":"https://api.github.com/users/kogmbh-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/kogmbh-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kogmbh-ci/subscriptions","organizations_url":"https://api.github.com/users/kogmbh-ci/orgs","repos_url":"https://api.github.com/users/kogmbh-ci/repos","events_url":"https://api.github.com/users/kogmbh-ci/events{/privacy}","received_events_url":"https://api.github.com/users/kogmbh-ci/received_events","type":"User","site_admin":false},"created_at":"2015-01-02T21:42:45Z","updated_at":"2015-01-02T21:42:45Z","body":"Build succeeded.\nRefer to this link for build results: http://ci.kogmbh.com/jenkins/job/WebODF-PullReq/2296/"}}