If we create a new page from /admin/pages/, edit and then save it, the page will be turned into a post, which is not an expected behavior.
The reason behind this is that when saving an existing page, we are actually using the route POST /admin/editor/:id/. The request is handled by PostSaveHandler, which sets p.IsPage = false.
We may need to create a new general handler(e.g. ContentSaveHandler) for POST /admin/editor/:id/. The handler should retrieve the existing post/page by id, change the fields according to form value and save it.
In addition, by doing this we will have some duplicate code among ContentSaveHandler, PostSaveHandler and PageSaveHandler. It would be great if we can extract some code from them and avoid the duplication.
If we create a new page from
/admin/pages/
, edit and then save it, the page will be turned into a post, which is not an expected behavior.The reason behind this is that when saving an existing page, we are actually using the route
POST /admin/editor/:id/
. The request is handled byPostSaveHandler
, which setsp.IsPage = false
.We may need to create a new general handler(e.g.
ContentSaveHandler
) forPOST /admin/editor/:id/
. The handler should retrieve the existing post/page by id, change the fields according to form value and save it.In addition, by doing this we will have some duplicate code among
ContentSaveHandler
,PostSaveHandler
andPageSaveHandler
. It would be great if we can extract some code from them and avoid the duplication.