Вопрос

I have nicEdit implemented in the backend for uploading news items, and in the frontend each newsitem has a square in front of the beginning of the text body (image attached). This only occurs in the first paragraph of the text.

Due to the paragraph tags added by nicEdit, the text is displayed on a different line than the square. I have searched in the nicEdit docs and in previously answered questions on here but could not find a solution. Is there any way to change the paragraph formatting in nicEdit to use br at the end of a paragraph instead of having it wrap the text with p tags? Or if not, to have Nicdit automatically add the square to the beginning of each text?

Thank you in advance for any help!!

http://i.stack.imgur.com/dxxtu.png

Edit: Turns out the p tags were not caused by the nicedit but by the users copy-pasting the articles. I have used this to remove formatting from pasted text, but the tags are still there (it seems to only remove font properties).

As a temporary fix I have added the square to the nicedit wysiwyg as initial text, so that it is sent to the db along with the rest of the text and inside the same paragraph.

Это было полезно?

Решение

I realized there's a line in the code you modified that specifies all the unwanted tags. You should add the paragraph there.

Search for

   /* remove undwanted tags */
    newSnippet = newSnippet.replace(/<(div|span|style|meta|link){1}.*?>/gi,'');

in the nicEditorInstance class, and change it to

   /* remove undwanted tags */
    newSnippet = newSnippet.replace(/<(div|p|span|style|meta|link){1}.*?>/gi,'');

Notice the "p" has been added. That will prevent nicEdit to wrap the paragraphs in

tags.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top