Giter Site home page Giter Site logo

substance-text's People

Contributors

afeld avatar alexblack avatar hasenj avatar michael avatar timjb avatar vectorsize avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

substance-text's Issues

Paste from Word in Firefox (3.6.12)

If I copy an article from spiegel.de to Microsoft Word and copy it again from Word and paste this in your editor in Firefox (Mac) there are css fragments left in the the editor. In Safari(Mac) it works correctly.

@font-face { font-family: "MS 明朝"; }@font-face { font-family: "Verdana"; }@font-face { font-family: "Cambria Math"; }@font-face { font-family: "Monaco"; }p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0cm 0cm 0.0001pt; font-size: 9pt; font-family: Monaco; }.MsoChpDefault { font-size: 10pt; font-family: Cambria; }div.WordSection1 { page: WordSection1; }ol { margin-bottom: 0cm; }ul { margin-bottom: 0cm; }

Selbstmordanschlag in Stockholm
FBI hilft ....

Coding guidelines

I'm not crazy about this.. but maybe we should rule out minor inconsistencies betw. our coding styles. :)

if($clicked.hasClass('tool') || $clicked.hasClass('content') || $clicked.is("span")) {
  events.trigger('surface:active');
}else{
}

vs. (with some whitespace)

if ($clicked.hasClass('tool') || $clicked.hasClass('content') || $clicked.is("span")) {
  events.trigger('surface:active');
} else {
}
function getText() {
  return $el.text();
}

Then we have:

var buffSize = 5 // we grab some extra text to make the search more specific
,   txt = getText()
,   findStart = txt.charAt(beg - buffSize)
,   findText = ''
,   i = beg - buffSize;

vs. (more JSON-esque)

var buffSize = 5, // we grab some extra text to make the search more specific
    txt = getText(),
    findStart = txt.charAt(beg - buffSize),
    findText = '',
    i = beg - buffSize;

totally for arguments for or against a particular style :)

Some minor issues (in Chrome)

Related to: michael@085ce36

  • When deleting a list (based on a selection that wraps the list) the
      markup remains
    • Select all (ctrl+a) + hit backspace + hit backspace again, drops the last paragraph. We should ensure that text is always wrapped in a paragraph.
    • Given that there's no selection, just the cursor: click code then click strong -> a whitespace gets inserted and selected.

    does not work on dynamically inserted HTML

    observed this on latest Chrome and Safari on Mac OS X Lion.

    Everything fine if the HTML node where I want to activate the editor exists statically at page load time.

    I am using sproutcore and the app gets generated from JS templates. Now I try to activate the editor on a Node which has been dynamically generated via JS, and I get:

    Chrome Error:

    TypeError: Cannot read property 'startContainer' of null
    

    Safari Error:

    TypeError: 'null' is not an object (evaluating 'sel.startContainer')
    

    Initializing empty noded with placeholder

    if I initialize an empty node by activating / deactivating, I would expect to have the placeholder as innerHTML of the node. But it remains empty. However if I click inside and outside the node, then I see the placeholder.

    Comments

    Good points you made in the TODO list. There are two use-cases (at least in the case of the composer).

    • Adding annotations / comments during editing
    • Adding comments (as a reader) later but they're stored on the document.. not on the text node.

    While we could definitely store some notes with links etc. I see the commenting use-case as something separate that is controlled from outside. For the composer I'm not sure if adding comments should be part of the text editing workflow, as comments should be something that stick on a document in the first place and refer to a particular part in the doc (e.g. a particular image). For some reason I think we should not include comments into text directly. They should be handled from outside.

    I thought about this. Why not defining a comment API for every Substance Node type. The node implementation (e.g. Text, Image) must implement that API. Text is a specific case because the comment might not refer not just to the entire paragraph but to a particular text selection.

    However.. comments should be controlled from outside.. they're not even stored on the node... but on the document. So comment deletion does not need to be handled by Text...

    Those are the pieces we need.

    // say `node` is a regular content node
    
    // init comments
    node.feedComments(commentlist); // already registered comments (the document knows about them, feed them in.. nothing is displayed at first)
    
    // once the comments are feeded there's a dependency.. so we need a mechanism to notify the document if changed content effects existing comments so the datastructures can be updated accordingly.
    
    // add a new comment (for text nodes the current selection is considered for determining start and endpos, for image nodes.. we don't need the start end data)
    node.addComment({content: "asdfadsf", user: "/user/foo"});
    
    // show all comments
    node.showComments();
    
    // unveil a particular comment.. 
    node.showComment(commentId);
    
    // hide comment markers
    node.hideComments()

    mhh.. now that I wrote this.. maybe we should factor out the bookkeeping of annotations in general (even em links etc)... so that they're done in a separate external data-structure that you just pass to the Substance Text constructor.

    New implementation

    So, I just pushed what I have so far of the new implementation using contenteditable and rangy for consistent ranges. There are many things not ready so far, like deleting annotations, or generating a delta based on the old and new text etc...
    However I must leave now, so I decided to push it so that you can start polaying around with it @michael . I also hope is clear enough for working with it. FYI there are still some position bugs regarding offsets and spans and stuff.

    Proper 0.3.0 issues

    Given that there's no selection, just the cursor located somewhere there's unintended behavior if you do the following.

    1. Click emphasized
    2. Click strong
    3. Click code
    4. Type some text

    => Styles are not exclusive all of them are applied

    Also:

    • Code can't be un-toggled when there's no selection
    • With no selection, when code is toggled on and some text is written.. the style is weird (while output is okay)

    Multiple simultaneous editors on page

    I'd love to have multiple simultaneous editors on the page, but when I try and instantiate Proper multiple times, there's only a single toolbar created. Are there any known work-arounds?

    Ace?

    Is there a technical reason for selecting codemirror instead of Ace or was it due to the MPL vs MIT licensing?

    Browser Support

    Hey guys,

    great work! Love the cleanliness of the editor and the amazing integration in substance.

    What is your current situation when it comes to browser support (maybe that would be worth adding to the readme) and what do you have in mind in terms of future compatbility efforts?

    Proper 0.5.0 API

    Just did some initial sketches on the new Proper API. See the README. I think we shouldn't do any UI stuff in the core, instead just provide an API for adding/manipulating and deleting annotations (that trigger the UI to update).

    Next to the core we should have a folder examples for concrete integration examples, e.g. for our em+strong+link+comment use-case. And another one for color markers. The Substance Composer can then just be built on top of the Core Interface.

    I think we should not expose any CodeMirror details on our API, and instead interfacing everything. E.g. we could hide the line concept from our users, if we find a way to internally project it to the CodeMirror foundation. By introducing our own interface we also free to use something else then CodeMirror in the future, without breaking the API.

    However, this are just some early thoughts, all open for discussion :). I will do some UI sketches on the Composer next, so we get a better sense what we need.

    substance-text dead-ends

    Do you mind sharing if substance-text had any shortcomings/dead-ends? (I mean in the sense of "The approach was not powerful enough for supporting annotations" or something).

    The README says its broken, but I was able to play with it successfully :)

    I'd like follow the idea of using a JS "diff" to generate commands (ins/del..) compatible to the "Substance Model".

    For now I'd be happy with something simpler and more limited than what Composer does.

    jQuery 1.7.1 support

    The current version of proper does not work good with jQuery 1.7.1

    I've been trying to fix this my self, but I can't figure it out.

    So far I've discovered problems with pasting. Instead of stripping markup, everything is pasted in.

    command key support in OS X

    On Chrome in OS X, the example at the project web page doesn't italicize when I press Command-I. When I press Ctrl-I it works. Ctrl-B doesn't work because it's bound to going back a character in OS X. (Emacs keys.)

    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.