Code Monkey home page Code Monkey logo

archivist-composer's Introduction

Substance.js Build Status

Substance is a JavaScript library for web-based content editing. It provides building blocks for realizing custom text editors and web-based publishing system. It is developed to power our online editing platform Substance.

Development

Install the dev dependencies.

npm install

Run the dev server.

npm start

Navigate to http://localhost:4001/test for the running the browser test suite. The test suite is rebuilt as you make changes to the source files.

To run the test-suite headless.

$ npm test

archivist-composer's People

Contributors

integral avatar obuchtala avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

archivist-composer's Issues

Basic tree implementation in place

just changes are not stored yet. please have a look if satisfied for a first version daniel.

will need a bit of tweaking and styling. but now this renders fast without the delays and we can connect the thing to undo/redo functionality of the composer.

New line errors

Steps to reproduce:

it will return error, and after this you will not able to hit enter anywhere, it'll always return error

Line breaks

Hey @oliver----!

Could you please add line breaks to this composer version? For shift+enter keys for example.

Thanks.

Find a way to map the title into the content container

Maybe we could go the route with a simple node array as a property of the document node instead of the content container node. Maybe then we could specify some function to determine the nodes that should go into into the top level container, and that could be passed somehow to the ContainerComponent. I understand that the title property differs from a text node and there's a different handling of expansion needed.

var myCustomContainerNodes = [
   "document.title", // since we know this is a string property we can expand it to the ["document", "title"] component
   "text_1",
   "text_2
];

Not good from a naming perspective since we mix nodes and properties. Maybe we need to call this a special concept.. like ContainerSeed that takes a list of paths in the doc and only expands nodes but not properties?

However, I guess it's not nice that now we have all info now in the model except for stuff like this. For the archivist maybe we should rather have a form editor for the title. Only thing we loose is moving the cursor with the keyboard.

Make consistent experience for editing references

E.g. when you want to assign another entity with a reference. Currently you need to delete it and create a new reference.

How can we prevent from having unassigned references? We currently have that case with subject references. We create them immediately and show an edit dialog. So the target property is empty at the beginning. It would be good ensure data consistency and have no instances of unassigned references at any time.

Problems with GraphIndexes on array properties

For subject references we use an array for the target property of a reference/annotation.

    "subject_reference_1": {
      "id": "subject_reference_1",
      "type": "subject_reference",
      "path": [
        "text_54",
        "content"
      ],
      "target": ["54bae4cda868bc6fab4bcd0e", "54bae99ca868bc3ec7fb5ad8"], // these are external objects
      "range": [
        85,
        95
      ]
    },

I also created an index to look up subject references by target.

  // Index subject references (multi-annotations)
  this.subjectReferencesIndex = this.addIndex('subjectReferencesIndex', {
    types: ["subject_reference"],
    property: "target"
  });

Now when i employ this index, i only get results for the first entry of the array.

doc.subjectReferencesIndex.get("54bae4cda868bc6fab4bcd0e")); // => ["subject_reference_1"]

doc.subjectReferencesIndex.get("54bae99ca868bc3ec7fb5ad8")); // => []

Click on active subject reference bracket leaves you in a active state again, 3rd click does what the second click should do

Following situation:

  • select some text inside of a paragraph (PropertySelection)
  • click subject reference bracket to highlight that subject reference
  • now click again on reference bracket

Expected: should be disabled now
Actual: it stays open

What happened?

  • selection change event gets fired right before second toggle (core extension switches state to default state)
  • toggle reference code than does the check if contextId = editSubjectReference and finds it's not so it activates it again.

Possible problem:

  • property selection somehow does not get cleared after first click
  • second toggle click leads to a blur finally and triggers the unwanted state change..

not sure how we should deal with that kind of problems... Oliver?

Mongo Problem: Incrementing of doc version not working properly anymore

while __v property gets incremented in database, the change doesn't get reflected in the doc that findByIdAndUpdate returns.

https://github.com/substance/archivist/blob/next/models/document.js#L192

For example when you save a doc with version 12, documentVersion: document.__v will evaluate to 12 after the update instead of 13. This leads to errors of subsequent saves.

I suspect something has changed in mongoose.. so results of findByIdAndUpdate don't have the latest updates.

@Integral can you check that?

It's needed so i can successfully complete and test autosave.

Use React via npm

there were some problems with it in combination (probably related to our CJSServer implementation). I include React currently via script tag and assume window.React is defined.

Brackets have wrong height

on initial loadpage

disappearing after any operation

steps to reproduce:

  • come and see in Daniel's laptop

Cannot remove more than 2 paras

Steps to reproduce:

  • select text from end of any para, next para and begin of another para
  • hit enter or backspace

it will return Uncaught TypeError: Cannot read property 'type' of undefined

Pasting few paras from webpage producing errors

If you pasting one para it usually blocks the content which is now very good (maybe we could define default behaviour like clean all html?)

But when you copy few paras and pasting them, it'll return TypeError: Cannot read property 'getComponents' of undefined {stack: (...), message: "Cannot read property 'getComponents' of undefined"}

Steps to reproduce:

  • go to http://substance.io/about/
  • navigate to Oliver Buchtala's section and copy few paras like bio and "Find him on Github"
  • paste it to composer

Tool doesn't get updating accordingly after toggling annotation

Now selections are preserved after toggling / untoggling an annotation (e.g. bold). However the tool only listens to selection changes to verify it's active state.

When reapplying of the prev. selection after transaction save, no selection:changed event get fired.

tx.save({ selection: Selection.create(path, range[0], range[1]) });

Maybe it should fire? Or we need another way of triggering the tools update.

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.