mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 07:42:48 +08:00
Update for composer branch
This commit is contained in:
parent
d0ef8e1c69
commit
faa0b6f2ce
2
extensions/markdown/.gitignore
vendored
2
extensions/markdown/.gitignore
vendored
|
@ -2,3 +2,5 @@
|
|||
composer.phar
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
bower_components
|
||||
node_modules
|
|
@ -9,6 +9,9 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
use Flarum\Markdown\Listener;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
return 'Flarum\Markdown\Extension';
|
||||
return function (Dispatcher $events) {
|
||||
$events->subscribe(Listener\FormatMarkdown::class);
|
||||
};
|
|
@ -1,10 +1,37 @@
|
|||
{
|
||||
"name": "flarum/markdown",
|
||||
"description": "Allow posts to be formatted with Markdown.",
|
||||
"type": "flarum-extension",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Toby Zerner",
|
||||
"email": "toby.zerner@gmail.com"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/flarum/core/issues",
|
||||
"source": "https://github.com/flarum/markdown"
|
||||
},
|
||||
"require": {
|
||||
"flarum/core": "^0.1.0-beta.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Flarum\\Markdown\\": "src/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"style": "phpcs --standard=PSR2 -np src"
|
||||
"extra": {
|
||||
"flarum-extension": {
|
||||
"title": "Markdown",
|
||||
"icon": {
|
||||
"image": "icon.svg",
|
||||
"backgroundColor": "#000",
|
||||
"backgroundSize": "100%",
|
||||
"backgroundRepeat": "no-repeat",
|
||||
"backgroundPosition": "center",
|
||||
"color": "#fff"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"name": "markdown",
|
||||
"title": "Markdown",
|
||||
"description": "Allow posts to be formatted with Markdown.",
|
||||
"keywords": ["discussions"],
|
||||
"version": "0.1.0-beta.2",
|
||||
"author": {
|
||||
"name": "Toby Zerner",
|
||||
"email": "toby@flarum.org",
|
||||
"homepage": "http://tobyzerner.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"flarum": ">=0.1.0-beta.2"
|
||||
},
|
||||
"support": {
|
||||
"source": "https://github.com/flarum/markdown",
|
||||
"issues": "https://github.com/flarum/core/issues"
|
||||
},
|
||||
"icon": {
|
||||
"name": "font",
|
||||
"backgroundColor": "#AB90D8",
|
||||
"color": "#fff"
|
||||
}
|
||||
}
|
1
extensions/markdown/icon.svg
Executable file
1
extensions/markdown/icon.svg
Executable file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="208" height="128" viewBox="0 0 208 128"><path d="M30 98v-68h20l20 25 20-25h20v68h-20v-39l-20 25-20-25v39zM155 98l-30-33h20v-35h20v35h20z" fill="#fff"/></svg>
|
After Width: | Height: | Size: 205 B |
3
extensions/markdown/js/.gitignore
vendored
3
extensions/markdown/js/.gitignore
vendored
|
@ -1,3 +0,0 @@
|
|||
bower_components
|
||||
node_modules
|
||||
dist
|
|
@ -1,7 +0,0 @@
|
|||
var gulp = require('flarum-gulp');
|
||||
|
||||
gulp({
|
||||
modules: {
|
||||
'markdown': 'src/**/*.js'
|
||||
}
|
||||
});
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"gulp": "^3.8.11",
|
||||
"flarum-gulp": "^0.1.0"
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
import { extend } from 'flarum/extend';
|
||||
import app from 'flarum/app';
|
||||
|
||||
app.initializers.add('markdown', function() {
|
||||
// TODO
|
||||
});
|
|
@ -1,2 +0,0 @@
|
|||
markdown:
|
||||
# hello_world: "Hello, world!"
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Markdown;
|
||||
|
||||
use Flarum\Support\Extension as BaseExtension;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
|
||||
class Extension extends BaseExtension
|
||||
{
|
||||
public function listen(Dispatcher $events)
|
||||
{
|
||||
$events->subscribe('Flarum\Markdown\Listeners\AddClientAssets');
|
||||
$events->subscribe('Flarum\Markdown\Listeners\AddMarkdownFormatter');
|
||||
}
|
||||
}
|
|
@ -8,19 +8,25 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Markdown\Listeners;
|
||||
namespace Flarum\Markdown\Listener;
|
||||
|
||||
use Flarum\Events\FormatterConfigurator;
|
||||
use Flarum\Event\ConfigureFormatter;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class AddMarkdownFormatter
|
||||
class FormatMarkdown
|
||||
{
|
||||
/**
|
||||
* @param Dispatcher $events
|
||||
*/
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(FormatterConfigurator::class, [$this, 'addMarkdownFormatter']);
|
||||
$events->listen(ConfigureFormatter::class, [$this, 'addMarkdownFormatter']);
|
||||
}
|
||||
|
||||
public function addMarkdownFormatter(FormatterConfigurator $event)
|
||||
/**
|
||||
* @param ConfigureFormatter $event
|
||||
*/
|
||||
public function addMarkdownFormatter(ConfigureFormatter $event)
|
||||
{
|
||||
$event->configurator->Litedown;
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Markdown\Listeners;
|
||||
|
||||
use Flarum\Events\RegisterLocales;
|
||||
use Flarum\Events\BuildClientView;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class AddClientAssets
|
||||
{
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(RegisterLocales::class, [$this, 'addLocale']);
|
||||
$events->listen(BuildClientView::class, [$this, 'addAssets']);
|
||||
}
|
||||
|
||||
public function addLocale(RegisterLocales $event)
|
||||
{
|
||||
$event->addTranslations('en', __DIR__.'/../../locale/en.yml');
|
||||
}
|
||||
|
||||
public function addAssets(BuildClientView $event)
|
||||
{
|
||||
$event->forumAssets([
|
||||
__DIR__.'/../../js/forum/dist/extension.js',
|
||||
__DIR__.'/../../less/forum/extension.less'
|
||||
]);
|
||||
|
||||
$event->forumBootstrapper('markdown/main');
|
||||
|
||||
$event->forumTranslations([
|
||||
// 'markdown.hello_world'
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user