In Mediawiki's tinymce extension, how to enable/disable buttons? - tinymce

In https://www.mediawiki.org/wiki/Extension:TinyMCE, there a section with Toolbar buttons including a Citation/reference button which looks like this:
Furthermore, it says: "Depending on configuration, some or all of these buttons may be shown".
It is not clear however how to enable/disable specific buttons in LocalSettings.php.
In the https://www.mediawiki.org/wiki/Extension:TinyMCE/Configuration page, there are instructions on how to add buttons to toolbars, and based on that I have added this to my LocalSettings.php:
wfLoadExtension( "TinyMCE" );
$wgTinyMCEEnabled = true;
$wgTinyMCESettings = [
".tox-tinymce" => [
"toolbar+" => " | citation",
],
];
.tox-tinymce being the selector for the text box where TinyMCE applies.
The citation button does not appear currently, and before I debug, I'd like to know (1) if I am on the right track, and (2) how can i know the machine name of a button (I assume it's citation, but maybe it's "footnote" or "cite", it is not clear where to find the mapping of machine names to buttons).

I have gone through the mediawiki-extensions-TinyMCE-master
Inside custom plugin directory mediawiki/plugins I saw 12 custom plugins.
I have opened one by one plugin code I observed only 3 plugins wikitext, wikitoggle , wikiupload are loaded in tinymce plugin manager. Ex:-
tinymce.PluginManager.add('wikitoggle', wikitoggle);
I could enable these buttons directly in load-extensions.php.
wfLoadExtension( "TinyMCE" );
$wgTinyMCEEnabled = true;
$wgTinyMCESettings = [
"#wpTextbox1" => [
"toolbar" => 'wikitext wikitoggle wikiupload',
],
];
I saw wikireference code at the end it has plugin function defination.
function Plugin () {
// only load plugin if the 'cite' extension is enabled
// in the wiki, eg, if 'ref' tag is in extension tag list
if ( extensionTagsList.split('|').indexOf('ref') > -1 ) {
pluginManager.add('wikireference', function (editor) {
registerCommands( editor );
registerButtons( editor );
setup( editor );
});
}
}
Plugin();
// only load plugin if the 'cite' extension is enabled
// in the wiki, eg, if 'ref' tag is in extension tag list
from the plugin method comments I could figure it out how to load reference and comment buttons.
first we need to download and install Cite extension plugin
echo 'Downloading and installing Cite'
echo 'See https://www.mediawiki.org/wiki/Extension:Cite#Installation'
curl -O -L https://github.com/wikimedia/mediawiki-extensions-Cite/archive/refs/heads/master.zip
unzip master.zip
rm master.zip
mv mediawiki-extensions-Cite-master extensions/Cite
Enable reference and comment button in load-extensions.php
[
"toolbar" => 'reference comment',
],
];

Related

RequestMiddlewares.php: new handling? (TYPO3 Extbase)

This used to work in TYPO3 9 and TYPO3 10 but is not working from me in TYPO3 11:
EXTDIR/Configuration/RequestMiddlewares.php
<?php
return [
'frontend' => [
'varioous/rest/mail-chimp-middleware' => [
'target' => Varioous\Rest\MailChimpMiddleware::class,
'before' => [
'typo3/cms-frontend/eid',
'typo3/cms-frontend/tsfe',
],
],
],
];
I've looked at this description here https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ApiOverview/RequestHandling/Index.html but I can't find the problem. The code is from this example: https://various.at/news/typo3-tipps-und-tricks-psr-15-mideelware-am-beispiel-mailchimp-webhook and has been adjusted to a custom made extension that has been working fine with TYPO3 9 and TYPO3 10. The particular extension belongs to the customer and I am not permitted to post it here. It is configured exactly as the mailchimp extension is in the how-to and I am sure the author used that how-to as a reference. As it seems, the mailchimp extension from the TER stopped using middleware - so I can't use the current version as a reference to fix my problem.
With this temporary workaround it's working fine:
<?php
return [
'frontend' => [
'varioous/rest/mail-chimp-middleware' => [
'target' => Varioous\Rest\MailChimpMiddleware::class,
'before' => [
# 'typo3/cms-frontend/eid',
# 'typo3/cms-frontend/tsfe',
],
],
],
];
How do I have to adjust the references to 'typo3/cms-frontend/eid' and 'typo3/cms-frontend/tsfe' for TYPO3 11? When I look up HTTP Middlewares (PSR-15) in the Configuration BackEnd module I can find them in the frontend category:
typo3/cms-frontend/eid = TYPO3\CMS\Frontend\Middleware\EidHandler
typo3/cms-frontend/tsfe = TYPO3\CMS\Frontend\Middleware\TypoScriptFrontendInitialization
FYI Further description of the Problem:
Once the extension is activated, ALL local extbase extensions stop working. For Example:
#1316104317 TYPO3\CMS\Extbase\Mvc\Exception
The default controller for extension "News" and plugin "Pi1" can not be determined. Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.
Of course there is nothing wrong with the news extension. I temporarily added a debug output in the file typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php
protected function loadDefaultValues()
{
$configuration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
print_r($configuration);
When the extension with the middleware is activated, the value "controllerConfiguration" in the array returned from the ConfigurationManager is empty (for all local extensions).

Vscode cant find function defined in contextBridge.exposeInMainWorld

I just started modifying the electron-react-boilerplate project and tried doing the following:
In the App.tsx file I added a button:
const ping = () => {
electron.ipcRenderer.myAwesomePing('Hello world!');
};
const Hello = () => {
return (
<div>
...
<button type="button" onClick={() => ping()}>
Ping!
</button>
...
</div>
);
};
And in the preload.js file, I added the corresponding call for myAwesomePing:
contextBridge.exposeInMainWorld('electron', {
ipcRenderer: {
myAwesomePing(text) {
ipcRenderer.send('ipc-example', text);
},
When I run the code, everything seems to work fine and I receive the ping through the context-bridge on the main process.
But, visual studio code keeps complaining, that it
Cannot find name 'electron'. Did you mean 'Electron'?
inside App.tsx.
Is this because I am missing something or just a bug in vscode? Is there maybe a build step necessary to create the connection?
ERB recently added support for globally exposed variables via preload:
https://github.com/electron-react-boilerplate/electron-react-boilerplate/blob/main/src/renderer/preload.d.ts
Copy and paste the file into your project and it should just work.

Tailwind CSS autocomplete inside Twig variables

I am using TailwindCSS with TWIG files. The purgecss works fine inside CSS files and also inside "normal" markup like
<div class="font-bold text-blue"></div>
But we are developing mostly Drupal TWIG templates and a lot of our TWIG files setting classes to an attributes array. And the bellow doesn't work.
attributes.addClass(['font-bold', 'bg-blue']);
or
{% set classes = ['font-bold', color == 'blue' ? 'bg-blue'] %}
This is my purgecss configuration:
gulp.task(
"styles",
gulp.series("sass", function () {
const postcssimport = require("postcss-import");
return gulp
.src("src/styles.css")
.pipe(sass().on("error", sass.logError))
.pipe(
postcss([
postcssimport(),
tailwindcss("./tailwind.config.js"),
autoprefixer,
])
)
.pipe(
purgecss({
mode: "layers",
content: ["templates/**/*.twig", "src/scss/**/*.scss"],
defaultExtractor: (content) => content.match(/[\w-/:]+(?<!:)/g) || [],
})
)
.pipe(gulp.dest("./css"));
})
);
Do you have any idea about this?
Thank you.
The TailwindCSS Intellisense plugin for VS code has an experimental setting that lets you set custom regex expressions that fire autocomplete. It's announced by the plugin's author here:
https://github.com/tailwindlabs/tailwindcss-intellisense/issues/129#issuecomment-735915659
I use these 2 regular expressions to activate autocomplete for {% set classes = [] } and <element{{ attributes.addClass() }}> respectively:
"tailwindCSS.experimental.classRegex": [
["classes =.+\\[([^\\]]*)\\]","'([^']*)'"],
["addClass\\(([^\\)]*)\\)","'([^']*)'"]
]
This goes into the main settings.json file for VS Code.

sr_freecap: viewhelper calls eIDSR instead of eID - no image shown

i want to imeplement the extension sr_freecap in an own extension in a TYPO3 9 LTS. The viewhelper shows the text and the correct html but the link to the image looks like this:
mydomain.com/index.php?eIDSR=sr_freecap_EidDispatcher&id=9781&vendorName=SJBR&extensionName=SrFreecap&pluginName=ImageGenerator&controllerName=ImageGenerator&actionName=show&formatName=png&L=0&set=571e0
When i call this url manually i get the whole page and not the image. Is eIDSR correct? I was in the opinion that the correct call should be eID= ... I can't find information about it.
Any help appreciated!
I missed the existing bug report: https://forge.typo3.org/issues/89735
I tried the above solution and it works:
Put in your extension in which you implements sr_freecap this file:
/your-extension/Configuration/RequestMiddlewares.php
with the following content:
<?php
return [
'frontend' => [
'srfreecap-eidhandler' => [
'target' => \SJBR\SrFreecap\Middleware\EidHandler::class,
'before' => [
'typo3/cms-frontend/content-length-headers',
],
]
]
];
this will work. Seems like a necaissary feature which is not mentioned in the manual.

CKEditor with widgettemplatemenu and widgetbootstrap

I am trying to get a version of the widgetbootstrap working with the widgettemplatemenu and have run into a snag. This is coded straight from the example found at http://albatrossdigital.github.io/widgetbootstrap/
The screen displays properly:
When I click the gear icon, the menu drops down and then immediately disappears.
Here is my config.js:
CKEDITOR.editorConfig = function( config ) {
// %REMOVE_START%
// The configuration options below are needed when running CKEditor from source files.
config.plugins = 'dialogui,dialog,about,a11yhelp,basicstyles,blockquote,clipboard,panel,floatpanel,menu,contextmenu,resize,button,toolbar,elementspath,enterkey,entities,popup,filebrowser,floatingspace,listblock,richcombo,format,horizontalrule,htmlwriter,wysiwygarea,image,indent,indentlist,fakeobjects,link,list,magicline,maximize,pastetext,pastefromword,removeformat,showborders,sourcearea,specialchar,menubutton,scayt,stylescombo,tab,table,tabletools,undo,wsc,lineutils,widget,bootstrapVisibility,autogrow,bbcode,colordialog,devtools,custimage,div,divarea,find,flash,floating-tools,forms,iframe,liststyle,onchange,pagebreak,placeholder,preview,showblocks,stylesheetparser,tableresize,uicolor';
config.skin = 'moono';
config.extraPlugins = 'widgetbootstrap,widgettemplatemenu';
// %REMOVE_END%
config.height = 400;
config.toolbar = [
[ 'Source', '-', 'NewPage', 'Preview', '-', 'Templates' ],
[ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ],
[ 'Bold' ],
[ 'WidgetTemplateMenu' ]
];
allowedContent: 'p a div span h2 h3 h4 h5 h6 section article iframe object embed strong b i em cite pre blockquote small,' +
'sub sup code ul ol li dl dt dd table thead tbody th tr td img caption mediawrapper br[href,src,target,width,height,colspan,' +
'span,alt,name,title,class,id,data-options]{text-align,float,margin}(*);';
};
I am pretty sure I have all dependent plugins loaded properly.
Has anyone else run into this problem?
Thanks,
JG
Update to issue:
I have noticed some other odd behavior. I added a Styles combo to the page and it exhibits the same behavior as the gear icon. I click and the styles list drops down then disappears.
It may be a coincidence but it seems very odd.
Perhaps missing or corrupt dependency? Which, by the way I have checked pretty thoroughly.