mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-13 01:41:09 +08:00
Fix task protocol editing with empty description [SCI-7823] (#4897)
This commit is contained in:
parent
2988390876
commit
02da980ab8
2 changed files with 5 additions and 6 deletions
|
|
@ -69,8 +69,10 @@ module ApplicationHelper
|
||||||
def smart_annotation_notification(options = {})
|
def smart_annotation_notification(options = {})
|
||||||
title = options.fetch(:title) { :title_must_be_present }
|
title = options.fetch(:title) { :title_must_be_present }
|
||||||
message = options.fetch(:message) { :message_must_be_present }
|
message = options.fetch(:message) { :message_must_be_present }
|
||||||
new_text = options.fetch(:new_text) { :new_text_must_be_present }
|
|
||||||
old_text = options[:old_text] || ''
|
old_text = options[:old_text] || ''
|
||||||
|
new_text = options[:new_text]
|
||||||
|
return if new_text.blank?
|
||||||
|
|
||||||
sa_user = /\[\@(.*?)~([0-9a-zA-Z]+)\]/
|
sa_user = /\[\@(.*?)~([0-9a-zA-Z]+)\]/
|
||||||
# fetch user ids from the previous text
|
# fetch user ids from the previous text
|
||||||
old_user_ids = []
|
old_user_ids = []
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,9 @@ class TinyMceAsset < ApplicationRecord
|
||||||
validates :estimated_size, presence: true
|
validates :estimated_size, presence: true
|
||||||
|
|
||||||
def self.update_images(object, images, current_user)
|
def self.update_images(object, images, current_user)
|
||||||
|
text_field = object.public_send(Extends::RICH_TEXT_FIELD_MAPPINGS[object.class.name]) || ''
|
||||||
# image ids that are present in text
|
# image ids that are present in text
|
||||||
text_images =
|
text_images = text_field.scan(/data-mce-token="([^"]+)"/).flatten
|
||||||
object.public_send(Extends::RICH_TEXT_FIELD_MAPPINGS[object.class.name])
|
|
||||||
.scan(/data-mce-token="([^"]+)"/)
|
|
||||||
.flatten
|
|
||||||
|
|
||||||
images = JSON.parse(images) + text_images
|
images = JSON.parse(images) + text_images
|
||||||
|
|
||||||
current_images = object.tiny_mce_assets.pluck(:id)
|
current_images = object.tiny_mce_assets.pluck(:id)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue