This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$editor = $("trix-editor") | |
$editor.on "paste", (e) -> | |
pastedText = e.originalEvent.clipboardData?.getData?("Text") | |
# we defer so we can get the cursor position after the pasting happens | |
# otherwise trix returns the position before | |
setTimeout( -> | |
if pastedText and !!pastedText.match(/^(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})$/ig) | |
element = $editor.get(0) | |
editor = element.editor | |
currentText = editor.getDocument().toString() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "find" | |
Find.find(".") do |file| | |
if file.match(/\.html$/) | |
puts "Filtering #{file}" | |
content = File.read(file) | |
no_source_content = content.gsub(/<table class="source_code".*?<\/table>/m, "") | |
File.open(file, "w") { |io| io.write no_source_content } | |
end | |
end |