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

Add default word break to trix content #150

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions .changeset/brown-beds-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"rhino-editor": patch
---

Add default word-break to .trix-content <https://github.com/basecamp/trix/pull/1126>
12 changes: 4 additions & 8 deletions docs/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,17 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# This will help ensure the proper Bridgetown version is running.
####

# If you need to upgrade/switch Bridgetown versions, change the line below
# and then run `bundle update bridgetown`
gem "bridgetown", "~> 1.1"
gem "bridgetown", "~> 1.3"

# Uncomment to add file-based dynamic routing to your project:
# gem "bridgetown-routes", "~> 1.1.0", group: :bridgetown_plugins
# gem "bridgetown-routes", "~> 1.3"

# Uncomment to use the Inspectors API to manipulate the output
# of your HTML or XML resources:
# gem "nokogiri", "~> 1.13"
gem "nokogiri", "~> 1.13"

# Puma is a Rack-compatible server used by Bridgetown
# (you can optionally limit this to the "development" group)
gem "puma", "~> 5.6"

gem "bridgetown-quick-search", "~> 1.1", :group => :bridgetown_plugins

gem "nokogiri", "~> 1.13"
gem "bridgetown-quick-search", "~> 2.0"
114 changes: 54 additions & 60 deletions docs/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
GEM
remote: https://rubygems.org/
specs:
activemodel (7.0.4.3)
activesupport (= 7.0.4.3)
activesupport (7.0.4.3)
activemodel (7.1.3)
activesupport (= 7.1.3)
activesupport (7.1.3)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.4)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
amazing_print (1.4.0)
bridgetown (1.2.0)
bridgetown-builder (= 1.2.0)
bridgetown-core (= 1.2.0)
bridgetown-paginate (= 1.2.0)
bridgetown-builder (1.2.0)
bridgetown-core (= 1.2.0)
bridgetown-core (1.2.0)
amazing_print (1.5.0)
base64 (0.2.0)
bigdecimal (3.1.6)
bridgetown (1.3.2)
bridgetown-builder (= 1.3.2)
bridgetown-core (= 1.3.2)
bridgetown-paginate (= 1.3.2)
bridgetown-builder (1.3.2)
bridgetown-core (= 1.3.2)
bridgetown-core (1.3.2)
activemodel (>= 6.0, < 8.0)
activesupport (>= 6.0, < 8.0)
addressable (~> 2.4)
amazing_print (~> 1.2)
colorator (~> 1.0)
csv (~> 3.2)
erubi (~> 1.9)
faraday (~> 1.0)
faraday_middleware (~> 1.0)
faraday (~> 2.0)
faraday-follow_redirects (~> 0.3)
hash_with_dot_access (~> 1.2)
i18n (~> 1.0)
kramdown (~> 2.1)
Expand All @@ -38,44 +46,28 @@ GEM
serbea (~> 1.0)
thor (~> 1.1)
tilt (~> 2.0)
webrick (~> 1.7)
zeitwerk (~> 2.5)
bridgetown-paginate (1.2.0)
bridgetown-core (= 1.2.0)
bridgetown-quick-search (1.1.3)
bridgetown (>= 0.15.0.beta1, < 2.0)
bridgetown-paginate (1.3.2)
bridgetown-core (= 1.3.2)
bridgetown-quick-search (2.0.0)
bridgetown (>= 1.2.0.beta2, < 2.0)
colorator (1.1.0)
concurrent-ruby (1.2.2)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
csv (3.2.8)
drb (2.2.0)
ruby2_keywords
erubi (1.12.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
ffi (1.15.5)
faraday (2.9.0)
faraday-net_http (>= 2.0, < 3.2)
faraday-follow_redirects (0.3.0)
faraday (>= 1, < 3)
faraday-net_http (3.1.0)
net-http
ffi (1.16.3)
hash_with_dot_access (1.2.0)
activesupport (>= 5.0.0, < 8.0)
i18n (1.13.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
kramdown (2.4.0)
rexml
Expand All @@ -85,46 +77,48 @@ GEM
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
minitest (5.18.0)
multipart-post (2.3.0)
minitest (5.21.2)
mutex_m (0.2.0)
net-http (0.4.1)
uri
nio4r (2.5.8)
nokogiri (1.13.9-arm64-darwin)
racc (~> 1.4)
nokogiri (1.13.9-x86_64-linux)
racc (~> 1.4)
public_suffix (5.0.1)
public_suffix (5.0.4)
puma (5.6.5)
nio4r (~> 2.0)
racc (1.6.0)
rack (3.0.7)
rake (13.0.6)
rack (3.0.8)
rake (13.1.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
roda (3.68.0)
rexml (3.2.6)
roda (3.76.0)
rack
rouge (3.30.0)
ruby2_keywords (0.0.5)
serbea (1.0.1)
activesupport (>= 6.0)
erubi (>= 1.10)
tilt (~> 2.0)
thor (1.2.2)
tilt (2.1.0)
thor (1.3.0)
tilt (2.3.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
webrick (1.8.1)
zeitwerk (2.6.8)
uri (0.13.0)
zeitwerk (2.6.12)

PLATFORMS
arm64-darwin-21
arm64-darwin-22
x86_64-linux

DEPENDENCIES
bridgetown (~> 1.1)
bridgetown-quick-search (~> 1.1)
bridgetown (~> 1.3)
bridgetown-quick-search (~> 2.0)
nokogiri (~> 1.13)
puma (~> 5.6)

Expand Down
22 changes: 22 additions & 0 deletions docs/config/initializers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Bridgetown.configure do |config|
config.url = ENV["URL"] || ENV["RELEASE_URL"] || "https://rhino-editor.vercel.app"
config.base_path = ENV.fetch("BASE_PATH", "/")
config.base_url = config.url + config.base_path
config.base_path_with_trailing_slash = config.base_path.ends_with?("/") ? config.base_path : config.base_path + "/"
config.base_path_no_trailing_slash = config.base_path.gsub(/\/$/, "")
init :"bridgetown-quick-search"

# init :ssr
# init :"bridgetown-routes"
# only :server do
# roda do |app|
# app.plugin :default_headers,
# 'Content-Type'=>'text/html',
# 'Strict-Transport-Security'=>'max-age=16070400;',
# 'X-Content-Type-Options'=>'nosniff',
# 'X-Frame-Options'=>'deny',
# 'X-XSS-Protection'=>'1; mode=block',
# 'Access-Control-Allow-Origin'=>'*'
# end
# end
end
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@shoelace-style/shoelace": "^2.12.0",
"@tiptap/extension-character-count": "~2.1.7",
"@tiptap/extension-code-block-lowlight": "~2.1.7",
"bridgetown-quick-search": "2.0.0",
"linkifyjs": "^4.1.1",
"lowlight": "^3.1.0",
"prosemirror-view": "1.28.2",
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/builders/inspectors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def build

def mark_external(document)
document.css("a[href^='http']").each do |anchor|
next unless anchor[:href]&.starts_with?("http") && !anchor[:href]&.include?(site.config.url)
next unless anchor[:href]&.starts_with?("http") && !anchor[:href].to_s.include?(site.config.url)

anchor[:target] = "_blank"
anchor[:rel] = "nofollow noopener noreferrer"
Expand Down
22 changes: 22 additions & 0 deletions docs/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 23 additions & 21 deletions src/exports/styles/trix-core.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
/* These all come from Trix / ActionText. This should probably be cleaned up into
a regular .css for users to include.
*/
.trix-content .rhino-upload-error {
background-color: rgba(255, 0, 0, 0.3);

.trix-content {
border: 1px solid var(--rhino-border-color);
border-radius: 0px 0px var(--rhino-border-radius) var(--rhino-border-radius);
margin: 0;
padding: 0.4em 0.6em;
min-height: 200px;
outline: transparent;
overflow-wrap: break-word;
word-break: break-word;
}

.trix-content[contenteditable="true"] {
/* Required by Prosemirror / TipTap */
white-space: pre-wrap;
}

.trix-content:is(:focus, :focus-within) {
border-color: var(--rhino-button-active-border-color);
}

.trix-content :is(img, svg, figure) {
Expand Down Expand Up @@ -46,6 +63,10 @@
white-space: break-spaces;
}

.trix-content .rhino-upload-error {
background-color: rgba(255, 0, 0, 0.3);
}

/* Attachments */
.trix-content:not([readonly])
figure:is(:focus-within, :focus, .has-focus):nth-child(2) {
Expand Down Expand Up @@ -74,25 +95,6 @@
cursor: text;
content: "";
}

.trix-content {
border: 1px solid var(--rhino-border-color);
border-radius: 0px 0px var(--rhino-border-radius) var(--rhino-border-radius);
margin: 0;
padding: 0.4em 0.6em;
min-height: 200px;
outline: transparent;
}

.trix-content[contenteditable="true"] {
/* Required by Prosemirror / TipTap */
white-space: pre-wrap;
}

.trix-content:is(:focus, :focus-within) {
border-color: var(--rhino-button-active-border-color);
}

.trix-content figure.attachment figcaption {
position: relative;
}
Expand Down
Loading
Loading