This commit is contained in:
2026-01-04 18:50:16 +09:00
parent 83fb6ee456
commit 1f44b17846
2 changed files with 11 additions and 6 deletions
@@ -49,7 +49,7 @@ class WikiPagesController < ApplicationController
case change.action
when ?=
{ type: 'context', content: change.old_element }
when ?|
when ?!
[{ type: 'removed', content: change.old_element },
{ type: 'added', content: change.new_element }]
when ?+
@@ -98,13 +98,18 @@ class WikiPagesController < ApplicationController
return head :unprocessable_entity if title.blank? || body.blank?
page = WikiPage.find(params[:id])
base_revision_id = page.current_revision.id
if params[:title].present? && params[:title].strip != page.title
return head :unprocessable_entity
end
message = params[:message].presence
Wiki::Commit.content!(page:, body:, created_user: current_user, message:)
Wiki::Commit.content!(page:,
body:,
created_user: current_user,
message:,
base_revision_id:)
head :ok
end
+4 -4
View File
@@ -40,10 +40,10 @@ export default () => {
{diff
? (
diff.diff.map (d => (
<span className={cn (d.type === 'added' && 'bg-green-200 dark:bg-green-800',
d.type === 'removed' && 'bg-red-200 dark:bg-red-800')}>
{d.content == '\n' ? <br/> : d.content}
</span>)))
<p className={cn (d.type === 'added' && 'bg-green-200 dark:bg-green-800',
d.type === 'removed' && 'bg-red-200 dark:bg-red-800')}>
{d.content}
</p>)))
: 'Loading...'}
</div>
</MainArea>)