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

Optimization of code block #1445

Merged
merged 12 commits into from
Oct 8, 2019
Merged

Optimization of code block #1445

merged 12 commits into from
Oct 8, 2019

Conversation

Jocs
Copy link
Member

@Jocs Jocs commented Oct 4, 2019

Q A
Bug fix? yes
Fixed tickets #1294
License MIT

Description


This change is Reviewable

@Jocs Jocs changed the title Optimization of code block [WIP]Optimization of code block Oct 4, 2019
@Jocs Jocs self-assigned this Oct 5, 2019
@Jocs Jocs added the 🐜 in progress This issue is in progress label Oct 5, 2019
@Jocs Jocs removed the 🐜 in progress This issue is in progress label Oct 5, 2019
@Jocs Jocs requested a review from fxha October 5, 2019 16:24
@Jocs Jocs changed the title [WIP]Optimization of code block Optimization of code block Oct 5, 2019
@fxha fxha mentioned this pull request Oct 6, 2019
26 tasks
Copy link
Contributor

@fxha fxha left a comment

Choose a reason for hiding this comment

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

1. XML issue:

Coping a full document with XML code blocks destroy the XML code lines.

foo

\```xml
<BookCatalogue xmlns="http://example.org">
    <Book>
        <Title>Foo Bar</Title>
        <author>Bar Fo</Author>
        <Date>0</Date>
        <ISBN>81-40-34319-4</ISBN>
    </Book>
</BookCatalogue>
\```

bar

2. Ctrl+A Stack Trace:

vue.esm.js?a026:628 [Vue warn]: Error in event handler for "selectAll": "IndexSizeError: Failed to execute 'extend' on 'Selection': There is no child at offset 658."


vue.esm.js?a026:1897 DOMException: Failed to execute 'extend' on 'Selection': There is no child at offset 658.
    at Selection.extend (<anonymous>)
    at Selection.setFocus (webpack-internal:///./src/muya/lib/selection/index.js:371:15)
    at Selection.setCursorRange (webpack-internal:///./src/muya/lib/selection/index.js:524:10)
    at ContentState.setCursor (webpack-internal:///./src/muya/lib/contentState/index.js:194:56)
    at ContentState.partialRender (webpack-internal:///./src/muya/lib/contentState/index.js:258:12)
    at ContentState.selectAll (webpack-internal:///./src/muya/lib/contentState/paragraphCtrl.js:952:19)
    at Muya.selectAll (webpack-internal:///./src/muya/lib/index.js:388:25)
    at VueComponent.handleSelectAll (webpack-internal:///./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./src/renderer/components/editorWithTabs/editor.vue?vue&type=script&lang=js&:701:21)
    at invokeWithErrorHandling (webpack-internal:///./node_modules/vue/dist/vue.esm.js:1862:26)
    at Vue.$emit (webpack-internal:///./node_modules/vue/dist/vue.esm.js:3885:9)

Example:

Ctrl+A in special code blocks no longer works. Paste example below and Ctrl+A inside code block.

foo

\```xml
<?xml version="1.0" encoding="UTF-8"?>
<BookCatalogue xmlns="http://www.publishing.org">
    <Book>
        <Title>Yogasana Vijnana: the Science of Yoga</Title>
        <author>Dhirendra Brahmachari</Author>
        <Date>1966</Date>
        <ISBN>81-40-34319-4</ISBN>
        <Publisher>Dhirendra Yoga Publications</Publisher>
        <Cost currency="INR">11.50</Cost>
    </Book>
    <Book>
        <Title>The First and Last Freedom</Title>
        <Author>J. Krishnamurti</Author>
        <Date>1954</Date>
        <ISBN>0-06-064831-7</ISBN>
        <Publisher>Harper &amp; Row</Publisher>
        <Cost currency="USD">2.95</Cost>
    </Book>
</BookCatalogue>
\```

foo

3. First line issue

Paste example below and, switch to preview mode and press Enter followed by Arrow-Up. The cursor jumps to the language identifier and not first line.

```cpp
int i = 0;
```

@Jocs
Copy link
Member Author

Jocs commented Oct 7, 2019

Paste example below and, switch to preview mode and press Enter followed by Arrow-Up. The cursor jumps to the language identifier and not first line.

I can not reproduce this issue, where is the cursor before press Enter and Arrow-Up?

@Jocs
Copy link
Member Author

Jocs commented Oct 7, 2019

Ctrl+A Stack Trace:

How strange, there must be some special characters that cause this issue, because it get ok after I edit some new content in the code block.

It's due to &amp;

@Jocs Jocs requested a review from fxha October 7, 2019 08:50
@Jocs
Copy link
Member Author

Jocs commented Oct 7, 2019

@fxha #1456 is blocked, because it depends on the codes in this PR, so I think we can use issues to track following bugs in this PRs, and merged first? if no severe bugs.

@Jocs
Copy link
Member Author

Jocs commented Oct 8, 2019

@fxha I merge this PR now, because #1456 depends on this PRs, you can submit issues if you find new bugs. and XSS issue and Ctrl+A Stack Trace have been fixed, the third bug, I can not reproduce it, please submit a new issue, if you can always reproduce it. thanks.

@Jocs Jocs merged commit 5b8da2c into develop Oct 8, 2019
@fxha fxha deleted the opti-code-block branch October 11, 2019 18:36
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.

None yet

2 participants