Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New extensions: side panel and outliner #284

Merged
merged 10 commits into from Dec 2, 2020
Merged

New extensions: side panel and outliner #284

merged 10 commits into from Dec 2, 2020

Conversation

CloudHill
Copy link
Contributor

@CloudHill CloudHill commented Nov 23, 2020

side-panel-demo

outliner

as suggested by #252.
the outliner is a panel extension that displays a table of contents listing the current page's header blocks.
you can navigate to any header by clicking on it on the panel.

side panel

the side panel extension serves as a container for other mods to display some information on a panel.
the extension will only execute if any panel extension is enabled.

creating a panel extension

to create a panel extension, add a panel key to mod.js with either a string or an object value.
it is also recommended to add panel to the extension's tags.

  • as a string, the value should be a relative path to an html file to be rendered on the panel.
  • as an object, the value can have the following properties:
key description type
html relative path to an html file to be rendered on the panel. string
name (optional) title to be displayed on the panel - falls back to the name defined in the exports object. string
icon (optional) relative path to an svg to be displayed as the panel's icon - falls back to the first letter of name. string
js (optional) relative path to a js module. the module should return an object with functions that will be executed in various events. string
fullHeight (optional) by default, the panel will shrink to its content's height when unlocked. set to true to prevent this. boolean
reload (optional) set to true to show a reload button on the panel boolean

example:

module.exports = {
  id: '87e077cc-5402-451c-ac70-27cc4ae65546',
  tags: ['extension', 'panel'],
  name: 'outliner',
  desc: 'table of contents.',
  version: '1.0.0',
  author: 'CloudHill',
  panel: {
    html: "panel.html",
    name: "Outline",
    icon: "icon.svg",
    js: "panel.js",
  }
};

panel event functions

your js module should return an object with one or more of these functions:

  • onLoad() runs after your html is rendered.
  • onSwitch() runs when the user switches to another panel extension.
  • onUnlock() runs when the panel is unlocked.
  • onLock() runs when the panel is locked.
  • onResize() runs when the user resizes the panel using the resize handle.

@admiraldus
Copy link
Contributor

can you make an animation almost same to the left sidebar?

@woniuxia
Copy link

woniuxia commented Dec 1, 2020

looking forward!

@laichunguang1
Copy link

Thank you! This extionsion is awesome. But I could I scroll in outliner when my table of contents is too long? Because it only show the front part of it.

@dragonwocky
Copy link
Member

@laichunguang1 see #881, not being able to scroll is a bug

@laichunguang1
Copy link

laichunguang1 commented Feb 6, 2022 via email

dragonwocky pushed a commit that referenced this pull request Nov 25, 2022
* upload side panel core

* upload outliner extension

* add onLoad, onSwitch, and onResize functions to panel extensions

* Update panel.js

* Add onLock and onUnlock functions to panel extensions

* Reordered side panel content loading

* change panel switcher font color

* fix loading last opened panel

* use svg icon files instead of defining them inline

* outliner: add full height option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants