Giter VIP home page Giter VIP logo

ckeditor-plugin-structured-headings's People

Contributors

bdeveau avatar caffodian avatar deti avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

contractmill

ckeditor-plugin-structured-headings's Issues

Lack of a selection change when creating a new heading

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

Improve the labels in the new dropdown

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

Style Rewrite

Enable per-element style selections

  • maintain baseclass on any numbered item
  • style on per-element type basis, IE "all H2s, all H3s" by a dropdown when one is selected
  • should update the object containing the current style, style object definition is mutable

revert restart numbering behaviour

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.

Discover the existing heading preset on document load

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.

Indent Headings and 'Children' items

Phase 1

  • UX: Change icon from H(up), H(dn) to indent/dedent styles
  • UX: Rename commands from increase/decrease? to indent/dedent? unindent? deindent?
  • Have commands apply standard indent/dedent functionality outside of a header

Phase 2

  • Actually apply indentation via left-margin or other means on a Header
  • apply indentation to all 'children' of that Header

Refactor the numstyles dropdown code

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:

  • figure out what to do based on the menu
  • lock the selection
  • execute the command
  • unlock the selection

List - to - Structured Headings

The Intent

When turning a list item into a heading using the matchHeading command, automatically apply to all other items at the same list-level.

The Catch

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.

Meta-ticket: CSS work

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;

UX Improvements

  • re-apply style when changing level
  • change colon to period
  • Add margin around style dialog elements
  • Make style names more friendly
  • Remove Style Dropdown from Toolbar in Sample, with documentation on how to do so
  • On Style Dialog, add name label below the thumbnail
  • Default style not highlighted at start

Changing Header Level

Users should be able to

  • Increase header level H1 -> H2 -> ... -> H6, disabled on H6
  • Decrease header level H6 -> H5 -> ... -> H1, disabled on H1

Per spec..

“In” a level

  • “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”?

“Out” a level

  • “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

Conversion of paragraphs with soft line breaks

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.

Enable numbering styles menu in paragraphs

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.

Label fixes (again)

usability test

  • The default state for the formatting dropdown is “format”. It should say “Formatting”
  • The tooltip on rollover of the format dropdown says “Numbering Formats”. It should say “Text Formatting”

some reverts

  • "Styling" => "Numbering"
  • "Clear Styling" => "Clear Numbering"
  • "Restart Styling" => "Restart Numbering"

Heading labels (update the dropdown label and also the background image displayed in the editor):

  • Heading 2 => Part Heading
  • Heading 3 => Subpart Heading
  • Heading 4 => Section Heading
  • Heading 5 => Subsection Heading
  • Heading 6 => Remove this from dropdown but all existing H6s to continue to exist

Other UI Changes

Include button for "Highlight"

Fix the tab key

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.

Implement the "toggle autonumbering" command

what it does

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.

states

  • “On” When the start of your current selection is in a heading block, the button should be “on”. It should have a dark background, similar to the behavior of the bulleted list button when your cursor is in a bulleted list) when your selection is in a heading block.
  • “Off” When your current selection is in a paragraph block, the button should be “off”. This is the normal style.
  • “Disabled” When your current selection is in anything else, the button should be “disabled”. The button text should be a light grey, similar to the behavior of the outdent button when your selection isn’t in a list.

where to start

  • without getting too far into figuring out the guts of CSS (reserved for #2)
  • create the command definition
  • create a helper function to determine if a given heading element is autonumbered
  • create a handler that fires on selection change. This handler will check if:
    • you are in a heading
    • the heading is autonumbered
      and set the command state accordingly.

Fix the weird heading reset

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 Max-Statements

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.

Change Heading Style

SPEC

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.

Determining a “nested set” of headings

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.

Restart Numbering

Spec

“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.

Fix up the dropdown displayed value

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)

Nested-restarts?

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

Implement "Toggle Heading" Command

What it is

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

States

  • “On” When the start of your current selection is in a heading block, the button should be “on”. It should have a dark background, similar to the behavior of the bulleted list button when your cursor is in a bulleted list) when your selection is in a heading block.
  • “Off” When your current selection is in a paragraph block, the button should be “off”. This is the normal style.
  • “Disabled” When your current selection is in anything else, the button should be “disabled”. The button text should be a light grey, similar to the behavior of the outdent button when your selection isn’t in a list.

Funcionality

When clicked when you are in a paragraph block:

  • Find the heading that was the most recent previous sibling of the current block. This is the “continuation heading” and determines the state of the heading we’re creating from this paragraph block.
  • If there is no “continuation heading” (e.g. the paragraph would be the first heading in the document), use h1 and make it auto-number by adding the default “autonumber-style-FOO” class.
  • If the “continuation heading” was auto-numbered, match the level (e.g. h2 if it was h2) and make it auto-numbered by adding the same “autonumber-style-FOO” class used by the “continuation heading”.
  • If the “continuation heading” wasn’t auto-numbered, match the level and add no classes, making it not auto-numbered.

When already in a heading:

  • Make the current block the standard paragraph block again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.