1.0.50 • Published 1 month ago

webhandle-page-editor v1.0.50

Weekly downloads
2
License
ISC
Repository
github
Last release
1 month ago

Purpose

Allows editing of HTMLish pages and templates using the CKEditor

Usage

On the client side, include the scripts like:

var editing = require('webhandle-page-editor')
editing({
	configFile: '/webhandle-page-editor/std-config.js'
})

The configFile used above is a sensible default but any config file can be used. jQuery must be available as a global variable.

On the server side, if you're a webhandle user, you can include all of server side handlers like:

let pageEditingRouter = express.Router()
require('webhandle-page-editor/webhandle-integrator')(webhandle, path.join(webhandle.projectRoot, 'pages'), pageEditingRouter)

You can then secure it for admin users like:

let securedRouter = require('webhandle-users/utils/allow-group')(
	['administrators', 'page-editors'],
	pageEditingRouter
)
webhandle.routers.primary.use('/webhandle-page-editor', securedRouter)

Each page has a json file specifying certain elements. They have the general format of:

{
	"editor": {
		"propertiesTemplate": "rsf-page-properties"
		,"disablePageEditor": true
	},
	"title": "The page titel",
	"description": "The page description",
	"pageVisibility": "public",
	"socialImage": "",
}

The properties template is some view. By default, and if not specified, this is:

views/webhandle-page-editor/page-properties-editor/basic-properties.tri

"disablePageEditor" if true will cause the "E" icon not to show.

It's possible to change where the "P" icon directs to by adding something like this to the page:

<script>
	window.page = {
		editor: {
			propertiesPage: "/news-items/__newsItem._id__/edit"
		}
	}
</script>

Custom page properties

Sometimes the properties page will need data setup. This can be done by adding to the array:

webhandle.services.pageEditor.pagePropertiesPrerun

Functions added should be of the form:

async (req, res) => {
	res.locals.someVariable = await [some long running process]
}
1.0.48

3 months ago

1.0.49

2 months ago

1.0.50

1 month ago

1.0.47

4 months ago

1.0.46

4 months ago

1.0.45

4 months ago

1.0.44

8 months ago

1.0.43

1 year ago

1.0.42

1 year ago

1.0.41

1 year ago

1.0.39

1 year ago

1.0.38

1 year ago

1.0.40

1 year ago

1.0.26

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.37

1 year ago

1.0.36

1 year ago

1.0.35

1 year ago

1.0.34

1 year ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.25

1 year ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.9

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.12

3 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago