policystat / ckeditor-plugin-structured-headings Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Instead of sticking it's commands in the Styles toolbar
I suspect this is an issue.
When creating new headings with the standard format dropdown, a selectionChange event is fired(verify if this happens?)
We changed this, and so autolinks ids are not always created, since they rely on a selection change to detect a new heading
We are missing MLA style A, 1, a, i
and we have some messed up version of it instead
We've started using Header & Heading interchangeably and it should probably be Heading everywhere.
Instead of describing the heading settings, provide a preview.
Document-Wide Styles
1. ?? ??
1. a. ??
A. ?? ??
I. A. ?
Heading-Specific Styles
Clear Styling
Restart Styling
I'm pretty sure this is due to the "detection" when you load a document
Currently it only applies to cursor, rather than to selection
I don't understand this usability test item, but it seems like I broke something
Previously, Restart Numbering restarted the chosen heading to the first of the currently selected numbering style. Now it also resets numbering as well as the numbering style, causing frustration for users. Let’s return to restarting numbering to the currently selected numbering style.
Don't use the presets & detection anymore.
Figure out what the current preset should be, based on the headings already in the document.
Alternately, we could add an extra invisible element that stores the preset, but that seems annoying to everything we've already done.
Currently, the list case is implemented as a command, the rest is not.
Implementing as a command would let us turn the dropdown handler into a fairly simple:
When turning a list item into a heading using the matchHeading command, automatically apply to all other items at the same list-level.
When Turning a LI into an H#, the Header item is pushed out of the list root and placed before it. IE:
ul
li
li <-
becomes:
h1 <-
ul
li
which is further complicated by sub-lists inside the main list. It may be necessary to recursively convert the entire list at once.
What CSS classes need to be defined?
What needs to be supported? Do we need to worry about any conflicts with the existing styles?
Currently, the list styles PolicyStat uses. Customers can also configure their own with some manual CSS editing, which some have done.
.document_body ol li {
margin-top: .5em;
}
.document_body ol {
list-style-type:upper-alpha;
}
.document_body ol ol {
list-style-type:decimal;
}
.document_body ol ol ol {
list-style-type:lower-alpha;
}
.document_body ol ol ol ol {
list-style-type: lower-roman;
}
.document_body ol ol ol ol ol {
list-style-type: lower-alpha;
}
.document_body ol ol ol ol ol ol {
list-style-type: lower-roman;
Something seems off now, and you need to set it for each new heading, seemingly.
The numbering menu options will instead apply list styles if used inside a list.
Clear numbering / restart will be unavailable in list.
“On” when in a heading that is not auto-numbered..
“Off” when in any other heading element.
“Disabled” when in any other element.
If the heading is already an h1 with autonumbering, then it turns off auto-numbering on this heading by removing all “autonumber-style-FOO” classes. Otherwise, it decreases the number of the current element (e.g. H2 -> H1).
TBD: Behavior when multiple headings are selected
TBD: If converting this element creates invalid nesting in other parts of this nested heading set, should we also move those headings “in”?
“On” when in the lowest allowed heading element (e.g. h6).
“Off” when in any other heading element.
“Disabled” when in any other element.
Increase the numbered level of the current heading (e.g. h1 -> h2), subject to some constraints.
If there exists a previous heading at level HX within this “nested set” of headings (see Determining a “nested set” of headings below), then the max allowed level we can increment to is h(X+1). So if the current nested set of headings doesn’t have an h3 (or wouldn’t, after this heading changed), then we shouldn’t allow the user to turn this heading into an h4. That creates invalid nesting.
H6 is the highest heading number
TBD: Behavior when multiple headings are selected
It should set all
Inspired by the other BR issue, we should at some point think about what to do when you have soft breaks within a paragraph.
Users don't always start a new paragraph when they actually should. Often times you'll see a very long p tag with lines separated with br.
We probably shouldn't do too much (the user can fix it by just using separate paragraphs), but we may run into usability issues.
We have an autosave plugin that hooks into CKEditor, however, it doesn't appear to detect dirtiness when headings are applied or unapplied
The dropdown for numbering styles will be re-enabled in paragraphs.
It will first apply the appropriate heading matching style, then apply the selected numbering style to the document.
to choose header style when not using structured headings
Include button for "Highlight"
Currently unknown how the plugin will function in terms of Creating a heading and removing a heading in entermode BR, P and DIV are supported for sure.
When no numbered headings are found, default to not-numbered
Not sure if this is "fix" or if it was never working. I'm pretty sure this was working before. :/
The tab key should increase or decrease heading level based on whether shift is held.
To adjust heading level
Something is very weird with the active state
It should add or remove the relevant autonumbering classes from a heading, if you are within a heading. For now, since we don't want to fuss about CSS, we can just have it apply an "autonumber" class to the heading.
Is this a good idea? to start at H2?
It'll be a pain to maintain later (it already kind of is). We should probably create the HTML programatically, which will also make it more testable.
Clearing selection causes the selectionChange handler to fire, but there's no element to check.
I need to understand what's going on in the video, but this is what Jana says:
select paragraph, make heading. Then apply numbering. Then, select another paragraph, apply heading. It then resets the numbering
Lint doesn't like having such a beefy INIT function for the plugin, need to research ways to split up the code a bit more to shut it up.
This will be a combobox that shows a visual representation for the user to select the heading style.
Options will be:
This corresponds to (out to h6):
1.a.i.a.i.a
1.1.1.1.1.1
A.a.i.a.i.a
I.A.1.a.1.a
Selecting a different option will modify each one of the headings included in the “nested set” (see below) of autonumbered headings, based on the start of your current selection.
All of the headings in this set will have any existing “autonumber-style-FOO” class(s) replaced with the chosen “autonumber-style-FOO” class.
Starting from the block element at the start of the selection, search backwards and include all autonumbered headings until you either hit a heading that uses a different heading style or an “autonumber-restart” at the h1 level (we don’t break on h2’s that have autonumber-restart). Don’t include that last heading (the reset or different-styled heading) in the set, but include everything else.
Search forward and follow the same logic.
“On” when in a heading that is marked as restarting numbering by having an “autonumber-restart” class.
“Off” when in a heading that is not marked as restarting numbering.
“Disabled” when selection is anything other than h1.
This will restart the heading numbering based on the start of your selection, by adding the “autonumber-restart” class. If the heading already has an “autonumber-restart” class, remove it.
I suspect because of the redundant breaks that sometimes get included at the end of a line:
for ex:
<p>[asdf<br>]</p>
vs <p>[asdf]<br></p>
We have a bunch of magic strings and direct calling of setValue, and sometimes the text doesn't actually match the selected option anymore. :/
(mainly saw this with clear)
Low hanging fruit:
"Normal Text" -> "Paragraph" in dropdown
"Restart Styling" -> "Restart Numbering"
Either all headings are structured,
or all headings are not.
Numbering can be restarted.
Should it be possible to create a separate numbering instance inside an existing one when enclosed in another stucture like a table? IE:
H1 H2 [Table] H1 H2 [/Table] H1
Possibly related to select all/range select?
You can't do the reverse of setting a heading style, which is clearing numbering from multiple headings
A button with the word “Heading”, that toggles selection between a heading and a paragraph, type of heading dependent on the most recent previous heading
When clicked when you are in a paragraph block:
When already in a heading:
currently, it incorrect converts them into headings
Run prettier on everything, ditch eslint
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.