Issue in OL/LI tag in first time edit - editor

I'm using the trix gem in my rails app. which has a front end in vuejs. When I enter text having OL and LI so in edit it displayed wrong format HTML even if I get the correct response from API
The initial text I enter is like thisenter image description here
when I save and open in edit the same it shows me like this:
enter image description here
Details
Browser name and version: Chrome
Operating system: Ubuntu
*ruby-version: ' 2.7.0'
*rails-version: '6.0.0'

Related

Action Text displaying image error rails 6 on windows 10

I am using windows 10 to program ruby on rails 6 with the help of ruby installer. Everything works fine so far until... I use action text for rich text editor.
I followed this guide [https://edgeguides.rubyonrails.org/action_text_overview.html][1] and everything works. But when I attach an image to the text_area, after saving the image cannot be displayed.
When I open the image's url, I see this:
MiniMagick::Error in ActiveStorage::RepresentationsController#show
`magick mogrify -resize-to-limit [1024, 768] C:/Users/.../AppData/Local/Temp/ActiveStorage-5-20200716-3792-28u8ot.jpg` failed with error: mogrify: unrecognized option `-resize-to-limit' # error/mogrify.c/MogrifyImageCommand/6009.
if status != 0 && options.fetch(:whiny, MiniMagick.whiny)
fail MiniMagick::Error, "`#{command.join(" ")}` failed with error:\n#{stderr}"
end
Model: Product
title
description(action text - attach image in text_area)
Display in view: product.description ( attached image cannot be displayed )
Can anyone help me solve this problem?
Add gem 'image-processing' to your Gemfile and
run bundle install

iMacros saveas results in empty CSV file in firefox

i have a very simple script in iMacros for Firefox
TAG POS=2 TYPE=TD ATTR=CLASS:head<SP>super EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=*
i can see a file being created but nothing is in it. I tried this in IE and it works fine. What am i missing here? I am using Firefox 27.0 and iMacros 8.6 in Win 7.
Thanks
Actually text was there but there were empty lines before the actual text, so when i opened csv in excel nothing was showing up. I opened it in a text editor and it was there. I trimmed the string after extracting and got what I wanted.

Hyperlink in CellRendererText Markup

I want to display a hyperlink in a pygtk table:
cr=gtk.CellRendererText()
column=gtk.TreeViewColumn(name)
column.add_attribute(cr, "markup", 0)
my_liststore=['google', ...]
Hyperlink "a" seems not supported by the markup. I get this warning:
GtkWarning: Failed to set text from markup due to error parsing markup: Unknown tag 'a' on line 1
How can I display a hyperlink in a pygtk table? And of course it should open the browser if you click on it ...
Update
Several month after asking this question: Here is my personal advice: don't use gtk. It is a dead horse. I don't know if Qt is better. The way to go is web technology.
Here are the lines which I use now. The cell gets rendered with blue color and underlined. The double click event calls a callback with uses the webbrowser module.
table = gtk.TreeView(list_store)
cr = gtk.CellRendererText()
# allow pango markup
column.add_attribute(cr, "markup", i)
# connect double click handler:
self.timeline.connect('row-activated', self.on_treeview_click)
# content in the data rows:
u'<span foreground="blue" underline="single">%s</span>' % (
glib.markup_escape_text(name))
Callback:
def on_treeview_click(self, treeview, path, view_column):
model=treeview.get_model()
action_id=model[path][0]
url='....' # build your url
import webbrowser
webbrowser.open(url)

nicEdit Uploading Locally - Issues with nicUpload

If anyone has managed to get locally uploading images I'd be mightily appreciative of some help.
I've downloaded the latest version of nicEdit along with the nicUpload plug in (from nicedit.com - Version 0.9 r24 released June 7th, 2012).
I've also downloaded nicUpload.php from http://svn.nicedit.com//trunk/nicUpload/php/nicUpload.php
NicUpload.php - I've set NICUPLOAD_PATH and NICUPLOAD_URI both to 'images' which is the subfolder of where nicupload.php and nicEdit.js are located.
NicEdit.js - I've added the following to line 271:-
uploadURI : 'nicUpload.php?id=123',
I've given it an ID otherwise it was failing with an invalid ID code. But the ?id=123 isn't meant to be there. I've also set the iconsPath accordingly.
Line 1370 I've switched this:-
nicURI : 'http://api.imgur.com/2/upload.json',
for this:-
nicURI : 'http://www.mydomain.com/nicedit/nicUpload.php',
But I'm still getting "Failed to upload image". I've searched and searched and searched for answers to this and I'm getting close to having spent two days tinkering with it.
With a few debugging displays I can see that it's failing on line 46 of nicUpload.php where it says:-
$file = $_FILES['nicImage'];
$image = $file['tmp_name'];
$max_upload_size = ini_max_upload_size();
if(!$file) {...
That last IF is true and that's where it exits with the error.
Appreciate anyone being able to help.
The nicUpload.php script file laying around sucks and I don't even understand how it could work.
NicEditor uses imgur as the default image upload service. The source code follows the API format described here: http://api.imgur.com/resources_anon#upload
My suggestion would be to implement the API request and response defined there.
I did not use the niceedit upload function to do what you want. I managed to add a button to the link and img dropdown menu. The button opens a file manager window where you also can upload. I managed to put then de url of the image or document into the nicedit drop down img or url window. That is how I solved the problem.

Displaying inline images on iPhone, iPad

I'm trying to create an email in Django with inline images.
msg = EmailMultiAlternatives(...)
image_file = open('file_path', 'rb')
img = MIMEImage(img_data)
image_file.close()
img.add_header('Content-ID', '<image1>')
img.add_header('Content-Disposition', 'inline')
msg.attach(img)
msg.send()
And in the template I would reference it like so:
<img src="cid:image1" />
This works fine in web browsers, outlook, thunderbird ... all except for the apple mail client on OSX, iPad and iPhone. The images are displayed twice. They are placed inline correctly but they are also attached to the bottom of the email. My question is, how do I get rid of the images at the bottom? or should I approach images in emails differently.
References:
http://djangosnippets.org/snippets/1507/
Django: How to send HTML emails with embedded images
creating a MIME email template with images to send with python / django
Different email clients choose to render multipart/mixed messages in different ways.
Most clients choose to render each part (in a "multipart" message) inline – in the order they were added to the email. However, if an image is referred to in a text/html part, most clients don't display that image again later on as part of the "inlining all parts" process.
Apple Mail on OSX and iOS are different, in so far as they will display each part in a multipart/mixed message in the order they were included, regardless of any inner references between HTML and images. This results in your images being displayed once within your HTML, and again at the end of the message where they've been inlined automatically.
The solution is to group your HTML and image assets into a single related part. i.e.:
from django.core.mail import EmailMultiAlternatives
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
# HTML + image container
related = MIMEMultipart("related")
# Add the HTML
html = MIMEText('an image: <img src="cid:some_image"/>', "html")
related.attach(html)
# Add an image
with open("icon.png", "rb") as handle:
image = MIMEImage(handle.read())
image.add_header("Content-ID", "<some_image>")
image.add_header("Content-Disposition", "inline")
related.attach(image)
# top level container, defines plain text version
email = EmailMultiAlternatives(subject="demo", body="plain text body",
from_email="foo#example.com",
to=["bar#example.com"])
# add the HTML version
email.attach(related)
# Indicate that only one of the two types (text vs html) should be rendered
email.mixed_subtype = "alternative"
email.send()

Resources