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

Create numbered and bulleted lists #674

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

satsuper
Copy link
Contributor

This PR aims to add the creation of lists in a document. This only aims to support numbered and bulleted lists and not image bullet lists for now.

TODO

  • Editor UI buttons
  • Detect list style at selection
  • Ops for list insertion/removal
  • OT support
  • Convert selected text to a list or selected list back to text
  • Add feature flags and session constraints
  • Default styles for numbered and bulleted lists

@satsuper satsuper added the draft label Jun 23, 2014
@satsuper satsuper changed the title Create numbered and bulleted lists [Draft] Create numbered and bulleted lists Jun 23, 2014
@@ -167,6 +169,9 @@ define("webodf/editor/Tools", [
// Paragraph direct alignment buttons
paragraphAlignment = createTool(ParagraphAlignment, args.directParagraphStylingEnabled);

// Paragraph direct alignment buttons
toggleLists = createTool(ToggleLists, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need it's own feature flag

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@satsuper satsuper changed the title [Draft] Create numbered and bulleted lists Create numbered and bulleted lists Aug 14, 2014
@@ -177,6 +177,7 @@ var Wodo = Wodo || (function () {
paragraphStyleEditingEnabled = isEnabled(editorOptions.paragraphStyleEditingEnabled),
imageEditingEnabled = isEnabled(editorOptions.imageEditingEnabled, true),
hyperlinkEditingEnabled = isEnabled(editorOptions.hyperlinkEditingEnabled, true),
listEditingEnabled = isEnabled(editorOptions.listEditingEnabled),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a 2nd parameter set to true to indicate the feature is still collab-unstable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

*/

/**
* This is the default style for numbered lists created by WebODF.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we also need built-in defaults for those settings? What is currently happening for lists which styles which do not have all those settings set? What are the built-in defaults used there, and should those not be the same used here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From memory a list with no style has no default fallback in webodf. The standard requires an implementation defined default http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1415150_253892949

I agree the same defaults should be used, maybe we could do what LO does and assign the bulleted style to any list without a style assigned.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automatically assigning (as in: setting) might be too much for existing lists (that might break the intention of the original creator of the list). Just using it when rendering would be good, yes (but perhaps you meant this).

But I was also thinking about properties which are not set, so some built-in default values would be used. That needs to be defined somewhere as well. At least by how I understand the schema currently that can happen. Hm. Need to think more about that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I did mean to use them only for rendering.


this.isListElement = isListElement;

/**
* Determine if the node is a text:list-item element.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add or a <text:list-header>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the comment

Satvik Kumar added 3 commits September 19, 2014 14:26
These operations work on the level of top level lists only

Added tests for the new operations and changed the op test code to parse
any op parameter containing "length" or "position" in the name as an integer
This handles transforms between Add/Remove list and other operations that
modify the number of steps in the document. There are some unresolved
conflicts with merging paragraphs and adding lists that return null as the
transform result which required merge and split operations on lists to be
resolved correctly.

Added tests for the new parts of the op transform matrix and changed the
op transform test code to parse any op parameter containing "length" or
"position" in the name as an integer.
@kogmbh-ci
Copy link

Build succeeded.
Refer to this link for build results: http://ci.kogmbh.com/jenkins/job/WebODF-PullReq/2258/

@@ -393,6 +393,34 @@ odf.OdfUtilsTests = function OdfUtilsTests(runner) {
testFontFamilyNameNormalizing("'serif'", "'serif'");
testFontFamilyNameNormalizing("\"serif\"", "\"serif\"");
}

function isListItemElement_ListItemOrListHeaderElements() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the naming pattern $methodname_$testcase this should be isListItemOrListHeaderElement_ListItemAndListHeaderElements

@kossebau
Copy link
Contributor

As you can see I have been hesitating so far to look at the code of the actual operations. Something in my mind told me I am not happy about them, but I could not say exactly what it was.

But now I know what made me unhappy: the lack of reasoning for the proposed operations and their spec. IMHO we should sit down this time and try to think about what operations there should be around lists, instead of going the painful try&error approach done in the initial prototyping of the WebODF editing (cough...removetext...cough).

So before continueing this PR I really would like to see a broader approach to the problem, before we spent our time on the actual implementation. If you agree please go here and add to the collection of ideas/plans around list operations:
https://github.com/kogmbh/WebODF/wiki/List-operations

@satsuper
Copy link
Contributor Author

Have gone through quite a bit of design around this with @peitschie and thought about what UI actions we want to support so it's definitely not a trial and error approach. I will fill out this wiki page with the design for this PR and the future work that I mentioned on the mailing list.

@kossebau
Copy link
Contributor

Forgot about the email, pardon (too much info at too many places 👀 ). Here for reference: https://open.nlnet.nl/pipermail/webodf/2014-August/000149.html (was there another one as well?)

Thanks for adding the notes also to the wiki page.

With the "trial and error" approach I was meaning that this time I would like to have a wider view of what the total number of operations around lists should be like. So far the proposed operations only cover a few use-cases, and they might fail with their specs and scopes once more use-cases are approached.

@peitschie
Copy link
Contributor

Hrm...I'm completely on board with improving process, but I am a little disappointed that this desire couldn't have been expressed several months ago when we made it clear that this was a feature we were planning to deliver. Fulfilling this change in expectations will likely cost us a day or two of dev time in order to document the design decisions in the now-desired format.

I have two major concerns here:

  1. This patch has been waiting 3 weeks for it's first round of commenting, and it's taken a further week to arrive at any solid conclusion. At that rate, it is likely to take weeks or even months to get any type of design approved.
  2. As this is the first operation (or even feature) to ever undergo this type of documentation and review, I have no way to estimate timelines or workload that will likely result. As you can probably appreciate, this makes it difficult to secure project time to advance this case.

If we are going to undertake this, I really need some idea from you @kossebau about how high a priority (and therefore, how timely) the design & code reviews for this feature would be...

@peitschie
Copy link
Contributor

If you agree please go here and add to the collection of ideas/plans around list operations:
https://github.com/kogmbh/WebODF/wiki/List-operations

A quick discussion with @satsuper, we think it will be best to put the design info into a standalone md file and raise a PR. The wiki interface doesn't allow any type of review interaction as will be necessary for this. On the PR, people can comment on specific lines and points, and see older revisions with comments.

Once the PR is signed off and everyone is happy, we can then transfer the markdown back to the wiki for permanent storage. Does that sound like a decent plan @kossebau @adityab ?

@kossebau
Copy link
Contributor

we think it will be best to put the design info into a standalone md file and raise a PR.

Sounds like that should work best, yes. Please do.

@adityab
Copy link
Member

adityab commented Sep 23, 2014

Once the PR is signed off and everyone is happy, we can then transfer the markdown back to the wiki for permanent storage. Does that sound like a decent plan @kossebau @adityab ?

Sounds fine.

@kossebau
Copy link
Contributor

I am a little disappointed that this desire couldn't have been expressed several months ago when we made it clear that this was a feature we were planning to deliver.

I can understand your disappointment very much. But then we/I have also learned quite a lot in all those months, and at least I draw the conclusion that ops need much more planning ahead and doing them on a case-by-case base is much more trouble in the end.

If we are going to undertake this, I really need some idea from you @kossebau about how high a priority (and therefore, how timely) the design & code reviews for this feature would be...

I will forward this to the person which rules me regarding that.... @th?

@adityab
Copy link
Member

adityab commented Sep 23, 2014

That said, If we are to move forward with this PR to at least land partial support for list editing (with a design discussion ongoing on the side of course), there's one thing that's very important - which is the ability to break out of a list and create a new paragraph after it.

@kossebau
Copy link
Contributor

There could perhaps be something like an ops playground, where ops are living that are just around for experiments and have not yet seen any proper review.
And the same with the UI for that.

@kossebau
Copy link
Contributor

Such a playground and the plugin infrastructure for that would also match what WebODF should ideally offer, being extensible by others with custom stuff. So would be a good testing for that.

@peitschie
Copy link
Contributor

But then we/I have also learned quite a lot in all those months, and at least I draw the conclusion that ops need much more planning ahead and doing them on a case-by-case base is much more trouble in the end.

Yes. I agree completely on this. But, please don't overlook the fact that I have been involved in all aspects of this for the last 1.5 years however. After all, I have authored the majority of the documentation WebODF has on many of these subjects...

That said, If we are to move forward with this PR to at least land partial support for list editing (with a design discussion ongoing on the side of course), there's one thing that's very important - which is the ability to break out of a list and create a new paragraph after it.

By the time we add the ops + transforms required to do that, this PR would be far to large to review. We already have this planned in our roadmap, and we have operations designed to allow this. For this PR however, I would consider it unnecessary as it isn't a regression over current master.

There could perhaps be something like an ops playground, where ops are living that are just around for experiments and have not yet seen any proper review.

A plugin system would help alleviate the current symptoms if this was a stability or technical problem, or a question about the long term desirability of the feature. Currently however, this PR is facing a clear review time shortage, so a plugin system would provide no gain to anyone.

@satsuper satsuper mentioned this pull request Sep 29, 2014
2 tasks
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.

5 participants