Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added support for HTML className for Block objects#791

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
SergeyBurtsev wants to merge6 commits intobasecamp:main
base:main
Choose a base branch
Loading
fromSergeyBurtsev:master
Open
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Fix after refactor
  • Loading branch information
@SergeyBurtsev
SergeyBurtsev committedFeb 23, 2021
commitf97c3a9f68e08f3ba1d9dc6822bed4acfe456993
2 changes: 1 addition & 1 deletiondist/trix-core.js
View file
Open in desktop

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletiondist/trix.js
View file
Open in desktop

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletionssrc/trix/models/block.coffee
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,13 +5,12 @@
class Trix.Block extends Trix.Object
@fromJSON: (blockJSON) ->
text = Trix.Text.fromJSON(blockJSON.text)
new this text, blockJSON.attributes, blockJSON.className
new this text, blockJSON.attributes

constructor: (text = new Trix.Text, attributes = [], className = '') ->
constructor: (text = new Trix.Text, attributes = []) ->
super
@text = applyBlockBreakToText(text)
@attributes = attributes
@className = className

isEmpty: ->
@text.isBlockBreak()
Expand All@@ -23,7 +22,7 @@ class Trix.Block extends Trix.Object
)

copyWithText: (text) ->
new @constructor text, @attributes, @className
new @constructor text, @attributes

copyWithoutText: ->
@copyWithText(null)
Expand Down
6 changes: 3 additions & 3 deletionssrc/trix/models/html_parser.coffee
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -140,7 +140,7 @@ class Trix.HTMLParser extends Trix.BasicObject

appendBlockForAttributesWithElement: (attributes, element) ->
@blockElements.push(element)
block = blockForAttributes(attributes, element?.className)
block = blockForAttributes(attributes)
@blocks.push(block)
block

Expand DownExpand Up@@ -185,9 +185,9 @@ class Trix.HTMLParser extends Trix.BasicObject
type = "attachment"
{attachment, attributes, type}

blockForAttributes = (attributes = {}, className = '') ->
blockForAttributes = (attributes = {}) ->
text = []
{text, attributes, className}
{text, attributes}

# Attribute parsing

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp