fix some bug

This commit is contained in:
BOHUNG 2019-09-28 21:19:38 +08:00
parent f8c03d2342
commit 4433d4d40d
2 changed files with 16 additions and 13 deletions

View File

@ -78,6 +78,7 @@ class Admin::PatchfilesController < OrbitAdminController
redirect_to admin_patchfiles_showckeditor_path
end
def newfont
params["patchfilefield"]["new_add_font"] = params["patchfilefield"]["new_add_font"].gsub('\"','').gsub("\'",'').gsub(";",'')
@field.new_add_font = params["patchfilefield"]["new_add_font"] rescue (redirect_to admin_patchfiles_showckeditor_path and return)
params["patchfilefield"]["font_array"].each_with_index do |(font,istrue),index|
if istrue =="0"

View File

@ -223,20 +223,22 @@ class Patchfilefield
end
end
@delete_font_array.each do |font_to_delete|
@str_above_end = @filedata.index(font_to_delete) - 1
@str_above_start
for @str_above_start in (0..@str_above_end).to_a.reverse
if @filedata[@str_above_start] =="\'" || @filedata[@str_above_start] =="\""
break
if @filedata.index(font_to_delete) != nil
@str_above_end = @filedata.index(font_to_delete) - 1
@str_above_start
for @str_above_start in (0..@str_above_end).to_a.reverse
if @filedata[@str_above_start] =="\'" || @filedata[@str_above_start] =="\""
break
end
break if @filedata[@str_above_start] == "\;"
end
@str_to_delete = (( @filedata[@str_above_start..@str_above_end].include? "\;") ? @filedata[@str_above_start..@str_above_end] : "")+font_to_delete
@filedata =@filedata.sub(@str_to_delete,"")
for @i in @str_start+1...@str_end
next if @filedata[@i] == " "
break if @filedata[@i] != "\;"
@filedata.slice!(@i)
end
break if @filedata[@str_above_start] == "\;"
end
@str_to_delete = (( @filedata[@str_above_start..@str_above_end].include? "\;") ? @filedata[@str_above_start..@str_above_end] : "")+font_to_delete
@filedata =@filedata.sub(@str_to_delete,"")
for @i in @str_start+1...@str_end
next if @filedata[@i] == " "
break if @filedata[@i] != "\;"
@filedata.slice!(@i)
end
end
puts self.used_font