markcyoung
Hello, I'm a newbie to DokuWiki - moving here from Wikispaces since they are closing down. Really enjoying the power of the engine and the plugins. Please direct me if I'm not posting in the proper place.
Here is my issue: I would like to have the tags for each wiki page displayed at the top of the page. This is accomplished by putting the tag syntax {{tag>...}} at the top of each page. However, when I edit the tags using CKGEditor's Tag plug-in, the tag syntax is moved to the end of the page and therefore displays at the bottom of each page.
I have been unable to locate a configuration option to change this behaviour, and a quick look at the condensed code for the Tag editor doesn't seem to be the place where the tag syntax is re-inserted into the page.
Can anyone point me in the right direction? Thanks in advance for the help.
turnermm
These changes have not been merged into the current distribution, so you will have to install it using the manual tab and the following link:
https://github.com/turnermm/ckgedit/archive/master.zip
You will find two choices: Bottom and Cursor. If you choose cursor, the tags will be installed at the cursor position. When choosing cursor, if you want the old tags to be updated, you have to select them with the mouse and the old will be overwritten by the new. I'll look forward to hearing from you and if all goes well this version of the tags plugin will be merged into the current distro.
markcyoung
Thank you for your quick reply and the code changes. I have tested them and they work as you have described. When I select the Cursor radio button, a dialog pops up saying: "<domain> says Current value: cursor". Similar behaviour happens when I select the Bottom radio button. Perhaps some left over debugging code?
To be honest with you, I'm not sure I can rely on my users to properly select the tag syntax when editing. For sure, we will end up with multiple tag syntaxes in our wiki pages.
For us, here is the ideal scenario. (I appreciate that there may be technical issues that make this difficult/impossible to do).
1. User is in CKGEditor
2. User clicks Tags button in toolbar
3. Tags dialog is displayed
4. User changes tag selection(s) and clicks OK.
5. Existing tag syntax is replaced "in place" by new tag syntax. i.e. if existing tag syntax is at the top, new syntax is inserted at the top, if it is at the bottom it is inserted at the bottom, and likewise for any other place on the wiki page.
This removes the need for the user to remember to select the tag syntax in advance and make additional selections in the Tag dialog. If the Tag syntax needs to be moved, it can be cut/pasted in the editor. I think a better solution overall.
Again, I appreciate there may be technical reasons why this is not possible.
turnermm
The tags plugin for ckgedit was written by one of the ckgedit users a while ago. It's well done, but since you've asked for this change, I've been looking at it and saw some other possibilities. There are now 3 choices--top, bottom, and cursor. Neither the top nor bottom require text selection. I've made top the default, at least for the current testing. It can be changed int the file plugin.js.
I discovered that if a user entered a tag into the editor manually, after the plugin was activated once during an editing session, the manually entered tag would be lost. Now fixed. One inconvenience, which I can't seem to get rid of: each time a new set of tags is inserted at the top of the page, the CKEditor inserts an extra newline after the tag markup. When this happens at the bottom of the document, it doesn't matter, but at the top it shows. But I wasn't able to get rid of it.
markcyoung
Nice work! This is wonderful and usable for us as-is. The extra newline inserted after the tags syntax at the top of the file goes away after a save/edit cycle so it is not a big problem.
One thing I did notice during testing was that upon any subsequent re-entry into the tags dialog during the same edit session:
1. Any previously unselected tags remain selected (i.e. the dialog shows the original state of the tags)
2. Any previously added tags show up in the Custom Tags section, even though they are pre-defined.
These are not big issues for us as I expect our users will only go into the Tag dialog once per edit session. They can be worked around if needed.
Thank you again for your help.
turnermm
1. Any previously unselected tags remain selected (i.e. the dialog shows the original state of the tags)
2. Any previously added tags show up in the Custom Tags section, even though they are pre-defined.
1. I'm not sure what I can do about this, given the way the original code was written. But it would be nice to fix it.
2. That's because the file hasn't been saved yet and so these tags don't have a checkbox. If they weren't in the custom box, they would get lost.
markcyoung
With respect to point #2, I should have been more clear in my wording. Here is the behaviour I see:
- Assume a wiki with 2 pre-defined tags "tag1" and "tag2"
- Assume a wiki page with tag1 {{tag>tag1}}
- Edit the page and open the Tags dialog
- Uncheck tag1 and check tag2, Click OK to exit the dialog
- New tag syntax in the page is correct {{tag>tag2}}
- Reopen the tags dialog in the same edit session
- tag1 is checked (this is point #1)
- tag2 is unchecked, Custom Tags is checked and "tag2" appears in the list of custom tags (this is point #2)
Again, I am very grateful for the changes you have made - and the small issue above is unlikely to affect my users. Just thought you should be aware of it.
turnermm
I think all of this has been reolved in the current update, which is still in the master branch. Once you've tested again and all seems right, I'll update the current distribution, which is 4.9-tinker. (The 4.9-tinker branch merges ckgedit with ckgdoku and updates the CKEditor from 4.7 to 4.9.)
https://github.com/turnermm/ckgedit/archive/master.zip
markcyoung
Tested and confirmed. Nice work!
turnermm
Thanks for testing this. I've merged the changes into 4.9-tinker, which is the current ckgedit distribution, as I mentioned above, i.e the distribution which the extension manager installs. But it is also still in the master, which will eventually be merged with 4.9-tinker.
homer83
I think because of this change the dialog for typing the tags does not popup anymore.
The Version
https://github.com/turnermm/ckgedit/archive/merger49.3.zip is still working.
The newer ones and the actual master causes an exception in ckeditor.js:
Exception
:
TypeError: Cannot read property 'charAt' of undefined at new <anonymous> (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:546:421) at Object.build (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:528:922) at Object.build (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:629:488) at Object.build (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:629:488) at CKEDITOR.dialog.addPage (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:602:443) at new CKEDITOR.dialog (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:591:339) at a.openDialog (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:634:134) at a.<anonymous> (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:634:497) at e (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:250:177) at Array.z (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:250:332)
message
:
"Cannot read property 'charAt' of undefined"
stack
:
"TypeError: Cannot read property 'charAt' of undefined↵ at new <anonymous> (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:546:421)↵ at Object.build (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:528:922)↵ at Object.build (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:629:488)↵ at Object.build (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:629:488)↵ at CKEDITOR.dialog.addPage (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:602:443)↵ at new CKEDITOR.dialog (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:591:339)↵ at a.openDialog (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:634:134)↵ at a.<anonymous> (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:634:497)↵ at e (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:250:177)↵ at Array.z (https://XXX/lib/plugins/ckgedit/ckeditor/ckeditor.js:250:332)"
turnermm
Are you referring to the tags popup? Which browser?
turnermm
Sorry, the above was from my phone.
If you are referring to the current distribution of ckgedit, which is installed form the extension manager, that version uses CKEditor 4.9, while the previous uses 4.7. If you have just upgraded to 4.9 from 4.7, I suggest you clear out your browser cache.
Which browser(s) are you using? The output that you supply doesn't help because it refers to a compressed javascript file. I've tested this with firefox, Opera, and chrome, both their latest versions. Chrome Version 69.0.3497.92, Firefox 62.0, Chrome 55.0.2994.56.
These are all on Windows. Abut also an older version of Safari on a Mac. I can't reproduce the error. So browser and operating system would help.
turnermm
I can add firefox 60.1 on Centos Linux to the above.
homer83
Sorry for the late answer. I was on holidays.
Yes i am referring to the tags popup.
I've just installed the latest Version from 2018-09-20 and cleared the browser cache.
It's still the same problem here.
I tried
- chrome browser 69 and Internet Explorer 11 and Firefox 62 on Win10 and
- Firefox 62, Internet Explorer 11 on Win7.
Is there anything I can do to help for locating the problem?
homer83
Maybe this helps:
All other buttons / plugins work as expected.
I tried the button for word plugin, geshi snippet, wrap-plugin. The page gets dark and the popup shows up.
But after pressing the button for the tag plugin, the page gets dark and nothing happens.
turnermm
This has been tested by @markcyoung and verified, as well as by me on a variety of platforms and configurations, i.e. placing the tags at the bottom or top of the page. Not sure what your problem is.
homer83
I've just updated to the latest version. It works.
But I have a little addition.
The text of the label "Place tags at: " is hard coded in tags.js
Thats why I inserted the new element radioLabel in de.js and en.js :-)
Not a big thing and i can live with it.
homer83
Ok i've found the problem:
We use the german language and the file
../ckeditor/plugins/tags/lang/de.js
differs from
../ckeditor/plugins/tags/lang/en.js.
In the german language file the elements info, bottom, cursor and top are not set.
turnermm
Perhaps you can provide the translations, and I will include them in an update to the ckgedit plugin. There is a lot of information about ckgedit on the plugin site at dokuwiki.org which makes it sometimes difficult to navigate, though I've tried my best by providing an index. Anyway, see
language support and localization, in particular the section on
plugins.