How does it work?
Every time someone wants to extend the application, instead of modifying original `publishing.js` file, he or she can subscribe to given events, e.g.
Scenario: Table Of Contents extension
```
// resources/public/js/toc.js
events.subscribe('content:rendered', function () {
// Prepend table of contents in edit mode on updates
});
events.subscribe('document:loaded', function () {
// Prepend table of contents on initial load in edit view and preview
});
```
Now, having structured way to hook into app allows to keep the main codebase maintainable and pretty stable and extremely extensible at the same time.
23 lines
420 B
HTML
23 lines
420 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>NoteHub — %TITLE%</title>
|
|
<meta charset="UTF-8" />
|
|
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
|
<link href="/style.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
%HEADER%
|
|
<article>
|
|
%CONTENT%
|
|
</article>
|
|
%FOOTER%
|
|
|
|
<script src="/js/events.js"></script>
|
|
<script>
|
|
events.publish('document:loaded');
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|