trying to add authorship colors when bolding, italicizing, etc.

29 views
Skip to first unread message

Mike

unread,
Jan 27, 2012, 10:23:17 AM1/27/12
to EtherPad Open Source Discussion
I see where to intercept the command in pad_editbar.js, but have had
no luck telling it to also add the author's bgcolor via css class to
the span.

I was using:

ace.ace_performDocumentApplyAttributesToCharRange(ace.ace_getRep().selStart,
ace.ace_getRep().selEnd, [['author', 'z122z9go0gitejp51rtx']])

or (in case the double brackets are not necessary):

ace.ace_performDocumentApplyAttributesToCharRange(ace.ace_getRep().selStart,
ace.ace_getRep().selEnd, ['author', 'z122z9go0gitejp51rtx'])

(z122z9go0gitejp51rtx is the userID of the main author I'm currently
testing with...hardcoded for now)

No errors are thrown, but nothing happens, either.

Can anyone point me in the right direction?

Thanks,
Mike

Mike

unread,
Jan 27, 2012, 12:37:53 PM1/27/12
to EtherPad Open Source Discussion
hmmm...the author class is being added, but no bgcolor applied. I
ended up using:

ace.ace_setAttributeOnSelection('author', 'z122z9go0gitejp51rtx');

Mike

unread,
Jan 27, 2012, 12:47:43 PM1/27/12
to EtherPad Open Source Discussion
the span class isn't formed quite correctly. It needs to be author-g-
z45zz122z122z122z9go0gitejp51rtx, but is author-
gz45zz122z122z122z9go0gitejp51rtx

Hope to crack this soon. I've got a Wednesday deadline for both this
and exporting with authorship colors (with legend for author name and
color). Any tips or hints would be awesome!

Thanks,
Mike

Mike

unread,
Jan 27, 2012, 12:53:20 PM1/27/12
to EtherPad Open Source Discussion
eureka! Got it:

ace.ace_setAttributeOnSelection('author', padutils.decodeUserId('g-
z122z9go0gitejp51rtx'));

Now I just need to grab the correct userId and pass it.

On Jan 27, 12:37 pm, Mike <mwar...@mindedge.com> wrote:

Mike

unread,
Jan 27, 2012, 3:50:58 PM1/27/12
to EtherPad Open Source Discussion
in case anyone else is looking for it, the solution was:

ace.ace_setAttributeOnSelection('author',pad.myUserInfo.userId);

Thanks to any who looked.
Reply all
Reply to author
Forward
0 new messages