Removed RichText & Markdown Deprecations (#6278)

* Removed RichText & Markdown Deprecations

* Removed BootstrapMarkdownAsset

* Removed more deprecations

* Updated composer.lock

* Fixes after merging develop to this branch

---------

Co-authored-by: yuriimaz <nopangolier1@gmail.com>
This commit is contained in:
Lucas Bartholemy 2023-07-07 09:19:25 +02:00 committed by GitHub
parent 6b5462897e
commit 7abae9d468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
105 changed files with 253 additions and 14032 deletions

View File

@ -24,3 +24,22 @@ Version 1.15 (Unreleased)
### Type restrictions
- `\humhub\libs\BaseSettingsManager` and its child classes on fields, method parameters, & return types
### Removed Deprecations
- `humhub\modules\content\widgets\richtext\PreviewMarkdown`
- `humhub\modules\content\widgets\richtext\ProsemirrorRichText::replaceLinkExtension`
- `humhub\modules\content\widgets\richtext\ProsemirrorRichText::scanLinkExtension`
- `humhub\modules\content\widgets\richtext\ProsemirrorRichText::parseOutput`
- `humhub\modules\content\widgets\richtext\AbstractRichText::$minimal`
- `humhub\modules\content\widgets\richtext\AbstractRichText::$maxLength`
- `humhub\modules\content\widgets\richtext\AbstractRichText::$markdown`
- `humhub\libs\Markdown`
- `humhub\libs\MarkdownPreview`
- `humhub\widgets\MarkdownEditor`
- `humhub\widgets\MarkdownField`
- `humhub\widgets\MarkdownFieldModals`
- `humhub\modules\ui\form\widgets\Markdown`
-

View File

@ -32,11 +32,9 @@
"matthewbdaly/zendsearch": "^0.0.3",
"mistic100/randomcolor": "^1.0",
"npm-asset/animate.css": "^4.0",
"npm-asset/at.js": "^1.5.1",
"npm-asset/bluebird": "^3.3.5",
"npm-asset/blueimp-file-upload": "^9.24",
"npm-asset/blueimp-gallery": "^2.36.0",
"npm-asset/bootstrap-markdown": "^2.10",
"npm-asset/bootstrap-tour": "^0.11.0",
"npm-asset/clipboard-polyfill": "^3.0",
"npm-asset/codemirror": "^5.59",

42
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f180ea8010eb5b8d645d6a8c6a253398",
"content-hash": "a5fb2a55a8202dc41d650e61eb20838f",
"packages": [
{
"name": "async-aws/core",
@ -3504,18 +3504,6 @@
"MIT"
]
},
{
"name": "npm-asset/at.js",
"version": "1.5.4",
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/at.js/-/at.js-1.5.4.tgz"
},
"type": "npm-asset",
"license": [
"MIT"
]
},
{
"name": "npm-asset/backo2",
"version": "1.0.2",
@ -3638,18 +3626,6 @@
"MIT"
]
},
{
"name": "npm-asset/bootstrap-markdown",
"version": "2.10.0",
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/bootstrap-markdown/-/bootstrap-markdown-2.10.0.tgz"
},
"type": "npm-asset",
"license": [
"Apache-2.0"
]
},
{
"name": "npm-asset/bootstrap-tour",
"version": "0.11.0",
@ -10968,17 +10944,17 @@
"source": {
"type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git",
"reference": "237f1821ece806de66072813d8cbe5bdbc8f3117"
"reference": "9920192eab87b9ae105696b0b86326c8fac91677"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/237f1821ece806de66072813d8cbe5bdbc8f3117",
"reference": "237f1821ece806de66072813d8cbe5bdbc8f3117",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/9920192eab87b9ae105696b0b86326c8fac91677",
"reference": "9920192eab87b9ae105696b0b86326c8fac91677",
"shasum": ""
},
"conflict": {
"3f/pygmentize": "<1.2",
"admidio/admidio": "<4.2.8",
"admidio/admidio": "<4.2.9",
"adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3",
"aheinze/cockpit": "<=2.2.1",
"akaunting/akaunting": "<2.1.13",
@ -11012,7 +10988,7 @@
"baserproject/basercms": "<4.7.5",
"bassjobsen/bootstrap-3-typeahead": ">4.0.2",
"bigfork/silverstripe-form-capture": ">=3,<3.1.1",
"billz/raspap-webgui": "<=2.6.6",
"billz/raspap-webgui": "<2.8.9",
"bk2k/bootstrap-package": ">=7.1,<7.1.2|>=8,<8.0.8|>=9,<9.0.4|>=9.1,<9.1.3|>=10,<10.0.10|>=11,<11.0.3",
"bmarshall511/wordpress_zero_spam": "<5.2.13",
"bolt/bolt": "<3.7.2",
@ -11241,7 +11217,7 @@
"modx/revolution": "<= 2.8.3-pl|<2.8",
"mojo42/jirafeau": "<4.4",
"monolog/monolog": ">=1.8,<1.12",
"moodle/moodle": "<4.2-rc.2|= 3.11",
"moodle/moodle": "<4.2-rc.2|= 4.2.0|= 3.11",
"mustache/mustache": ">=2,<2.14.1",
"namshi/jose": "<2.2",
"neoan3-apps/template": "<1.1.1",
@ -11349,7 +11325,7 @@
"shopware/core": "<=6.4.20",
"shopware/platform": "<=6.4.20",
"shopware/production": "<=6.3.5.2",
"shopware/shopware": "<=5.7.14",
"shopware/shopware": "<=5.7.17",
"shopware/storefront": "<=6.4.8.1",
"shopxo/shopxo": "<2.2.6",
"showdoc/showdoc": "<2.10.4",
@ -11576,7 +11552,7 @@
"type": "tidelift"
}
],
"time": "2023-06-22T20:04:46+00:00"
"time": "2023-06-28T23:04:41+00:00"
},
{
"name": "softcreatr/jsonpath",

View File

@ -1,40 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\assets;
use yii\web\AssetBundle;
/**
* jquery-At.js
*
* @author buddha
* @deprecated since v1.5 not in use anymore
*/
class AtJsAsset extends AssetBundle
{
/**
* @inheritdoc
*/
public $sourcePath = '@npm/at.js';
/**
* @inheritdoc
*/
public $js = ['dist/js/jquery.atwho.min.js'];
/**
* @inheritdoc
*/
public $depends = [
CaretjsAsset::class,
AtJsStyleAsset::class
];
}

View File

@ -1,39 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\assets;
use yii\web\AssetBundle;
/**
* jquery-At.js
*
* @author buddha
* @deprecated since v1.5 not in use anymore
*/
class AtJsStyleAsset extends AssetBundle
{
/**
* @inheritdoc
*/
public $basePath = '@webroot-static';
/**
* @inheritdoc
*/
public $baseUrl = '@web-static';
/**
* @inheritdoc
*/
public $css = [
'css/jquery.atwho.modified.css',
];
}

View File

@ -1,39 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\assets;
use yii\web\AssetBundle;
/**
* Bootstrap Markdown
*
* @see https://github.com/toopay/bootstrap-markdown
* @author luke
*/
class BootstrapMarkdownAsset extends AssetBundle
{
/**
* @inheritdoc
*/
public $sourcePath = '@npm/bootstrap-markdown';
/**
* @inheritdoc
*/
public $js = [
'js/bootstrap-markdown.js',
];
/**
* @inheritdoc
*/
public $css = ['css/bootstrap-markdown.min.css'];
}

View File

@ -1,49 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\assets;
use humhub\components\assets\WebStaticAssetBundle;
use yii\web\AssetBundle;
/**
* IE9FixesAsset provides CSS/JS fixes for Internet Explorer 9 versions
*
* @see IEFixesAsset for older IE versions
* @since 1.2
* @author Luke
* @deprecated since v1.5 not in use anymore
*/
class IE9FixesAsset extends WebStaticAssetBundle
{
/**
* @inheritdoc
*/
public $basePath = '@webroot-static';
/**
* @inheritdoc
*/
public $baseUrl = '@web-static';
/**
* @inheritdoc
*/
public $css = [
'css/ie9.css',
];
/**
* @inheritdoc
*/
public $cssOptions = [
'condition' => 'IE 9'
];
}

View File

@ -1,54 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\assets;
use yii\web\AssetBundle;
/**
* Html5shivAsssets - the HTML5 shim, for IE6-8 support of HTML5 elements
*
* @since 1.2
* @author Luke
* @deprecated since v1.5 not in use anymore
*/
class IEFixesAsset extends AssetBundle
{
/**
* @inheritdoc
*/
public $basePath = '@webroot-static';
/**
* @inheritdoc
*/
public $baseUrl = '@web-static';
/**
* @inheritdoc
*/
public $css = [
'css/ie.css',
];
/**
* @inheritdoc
*/
public $cssOptions = [
'condition' => 'lt IE 9'
];
/**
* @inheritdoc
*/
public $depends = [
'humhub\assets\Html5shivAsset',
];
}

View File

@ -1,32 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\assets;
use yii\web\AssetBundle;
/**
* tabbed form asset
*
* @author buddha
* @deprecated since 1.4 the ui.form namespace is now part of core api
*/
class UIFormAsset extends AssetBundle
{
public $jsOptions = ['position' => \yii\web\View::POS_END];
public $basePath = '@webroot-static';
public $baseUrl = '@web-static';
/**
* @inheritdoc
*/
public $js = ['js/humhub/humhub.ui.form.js'];
}

View File

@ -1,43 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\controllers;
use Yii;
use humhub\components\Controller;
use humhub\components\behaviors\AccessControl;
use humhub\widgets\MarkdownView;
/**
* MarkdownController provides preview for MarkdownEditorWidget
*
* @author luke
* @since 0.11
*/
class MarkdownController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'acl' => [
'class' => AccessControl::class,
]
];
}
public function actionPreview()
{
$this->forcePostRequest();
return MarkdownView::widget(['markdown' => Yii::$app->request->post('markdown')]);
}
}

View File

@ -1,143 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\libs;
use cebe\markdown\GithubMarkdown;
use yii\helpers\Url;
use humhub\modules\file\models\File;
/**
* Class Markdown parser for legacy markdown editor output.
*
* @package humhub\libs
* @deprecated since 1.8 use RichTextToHtmlConverter instead
*/
class Markdown extends GithubMarkdown
{
protected function handleInternalUrls($url)
{
// Handle urls to file
if (substr($url, 0, 10) === 'file-guid-') {
$guid = str_replace('file-guid-', '', $url);
$file = File::findOne(['guid' => $guid]);
if ($file !== null) {
return $file->getUrl();
}
}
return $url;
}
protected function renderLink($block)
{
if (isset($block['refkey'])) {
if (($ref = $this->lookupReference($block['refkey'])) !== false) {
$block = array_merge($block, $ref);
} else {
return $block['orig'];
}
}
$block['url'] = $this->handleInternalUrls($block['url']);
$baseUrl = Url::base(true);
$url = (empty($block['url'])) ? $baseUrl : $block['url'];
return Html::a($this->renderAbsy($block['text']), Html::decode($url), [
'target' => '_blank'
]);
}
protected function renderImage($block)
{
if (isset($block['refkey'])) {
if (($ref = $this->lookupReference($block['refkey'])) !== false) {
$block = array_merge($block, $ref);
} else {
return $block['orig'];
}
}
$block['url'] = $this->handleInternalUrls($block['url']);
return '<img src="' . htmlspecialchars($block['url'], ENT_COMPAT | ENT_HTML401, 'UTF-8') . '"'
. ' alt="' . htmlspecialchars($block['text'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE, 'UTF-8') . '"'
. (empty($block['title']) ? '' : ' title="' . htmlspecialchars($block['title'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE, 'UTF-8') . '"')
. ($this->html5 ? '>' : ' />');
}
protected function renderAutoUrl($block)
{
return Html::a($block[1], $block[1], ['target' => '_blank']);
}
/**
* Renders a code block
* @param $block
* @return string
*/
protected function renderCode($block)
{
$class = isset($block['language']) ? ' class="' . Html::encode($block['language']) . '"' : '';
return "<pre><code $class>" . $block['content'] . "\n" . "</code></pre>\n";
}
/**
* "Dirty" hacked LinkTrait
*
* Try to allow also wiki urls with whitespaces etc.
* @param $markdown
* @return array|bool
*/
protected function parseLinkOrImage($markdown)
{
if (strpos($markdown, ']') !== false && preg_match('/\[((?>[^\]\[]+|(?R))*)\]/', $markdown, $textMatches)) { // TODO improve bracket regex
$text = $textMatches[1];
$offset = strlen($textMatches[0]);
$markdown = substr($markdown, $offset);
$pattern = <<<REGEXP
/(?(R) # in case of recursion match parentheses
\(((?>[^\s()]+)|(?R))*\)
| # else match a link with title
^\(\s*(((?>[^\s()]+)|(?R))*)(\s+"(.*?)")?\s*\)
)/x
REGEXP;
if (preg_match($pattern, $markdown, $refMatches)) {
// inline link
return [
$text,
isset($refMatches[2]) ? $refMatches[2] : '', // url
empty($refMatches[5]) ? null : $refMatches[5], // title
$offset + strlen($refMatches[0]), // offset
null, // reference key
];
} elseif (preg_match('/\((.*?)\)/', $markdown, $refMatches)) {
// reference style link
if (empty($refMatches[1])) {
$key = strtolower($text);
} else {
$key = strtolower($refMatches[1]);
}
return [
$text,
$refMatches[1],
$text, // title
$offset + strlen($refMatches[0]), // offset
null,
];
}
}
return false;
}
}

View File

@ -1,165 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\libs;
use cebe\markdown\block\HeadlineTrait;
use cebe\markdown\Parser;
/**
* MarkdownPreview generates a plain text (no HTML) of markdown.
* Some elements like images or links will be displayed more clearly.
*
* @since 0.11.1
* @deprecated since 1.8 use RichTextToPlainTextConverter isntead
*/
class MarkdownPreview extends Parser
{
use HeadlineTrait;
protected function renderParagraph($block)
{
return $this->renderAbsy($block['content']) . "\n";
}
/**
* Renders a headline
*/
protected function renderHeadline($block)
{
return $this->renderAbsy($block['content']) ."\n";
}
/**
* Parses a link indicated by `[`.
* @marker [
*/
protected function parseLink($markdown)
{
if (!in_array('parseLink', array_slice($this->context, 1)) && ($parts = $this->parseLinkOrImage($markdown)) !== false) {
list($text, $url, $title, $offset, $key) = $parts;
return [
[
'link',
'text' => $this->parseInline($text),
'url' => $url,
'title' => $title,
'refkey' => $key,
'orig' => substr($markdown, 0, $offset),
],
$offset
];
} else {
// remove all starting [ markers to avoid next one to be parsed as link
$result = '[';
$i = 1;
while (isset($markdown[$i]) && $markdown[$i] == '[') {
$result .= '[';
$i++;
}
return [['text', $result], $i];
}
}
/**
*
* @param type $block
* @marker ![
*/
protected function parseImage($markdown)
{
if (($parts = $this->parseLinkOrImage(substr($markdown, 1))) !== false) {
list($text, $url, $title, $offset, $key) = $parts;
return [
[
'image',
'text' => $text,
'url' => $url,
'title' => $title,
'refkey' => $key,
'orig' => substr($markdown, 0, $offset + 1),
],
$offset + 1
];
} else {
// remove all starting [ markers to avoid next one to be parsed as link
$result = '!';
$i = 1;
while (isset($markdown[$i]) && $markdown[$i] == '[') {
$result .= '[';
$i++;
}
return [['text', $result], $i];
}
}
protected function parseLinkOrImage($markdown)
{
if (strpos($markdown, ']') !== false && preg_match('/\[((?>[^\]\[]+|(?R))*)\]/', $markdown, $textMatches)) { // TODO improve bracket regex
$text = $textMatches[1];
$offset = strlen($textMatches[0]);
$markdown = substr($markdown, $offset);
$pattern = <<<REGEXP
/(?(R) # in case of recursion match parentheses
\(((?>[^\s()]+)|(?R))*\)
| # else match a link with title
^\(\s*(((?>[^\s()]+)|(?R))*)(\s+"(.*?)")?\s*\)
)/x
REGEXP;
if (preg_match($pattern, $markdown, $refMatches)) {
// inline link
return [
$text,
isset($refMatches[2]) ? $refMatches[2] : '', // url
empty($refMatches[5]) ? null : $refMatches[5], // title
$offset + strlen($refMatches[0]), // offset
null, // reference key
];
} elseif (preg_match('/^([ \n]?\[(.*?)\])?/s', $markdown, $refMatches)) {
// reference style link
if (empty($refMatches[2])) {
$key = strtolower($text);
} else {
$key = strtolower($refMatches[2]);
}
return [
$text,
null, // url
null, // title
$offset + strlen($refMatches[0]), // offset
$key,
];
}
}
return false;
}
protected function renderLink($block)
{
$result = '';
if (isset($block['text']) && isset($block['text'][0]) && isset($block['text'][0][1])) {
$result = $block['text'][0][1];
}
if (!empty($result) && isset($block['url']) && strrpos($block['url'], 'mention:') === 0) {
$result = '@'.$result;
}
return $result;
}
protected function renderImage($block)
{
return "[" . $block['text'] . "]";
}
}

View File

@ -1,54 +0,0 @@
<?php
namespace humhub\modules\content\tests\codeception\unit;
use humhub\modules\content\widgets\richtext\ProsemirrorRichText;
use tests\codeception\_support\HumHubDbTestCase;
class RichtextExtensionTest extends HumHubDbTestCase
{
public function testScanMultipleFileGuid()
{
$text = '[img3.jpg](http://humhub.com "img)3.jpg" xasdfjpös0as)
[test2.txt](file-guid:aef0eb95-b715-4707-9792-180e4395e681)
test
![img3.jpg](file-guid:3f1e14a2-4375-434a-a554-a19ec5e48909 "img))))3.jpg")asdfas
asdfasdfasdf
[test2.txt](file-guid:aef0eb95-b715-4707-9792-180e4395e681 "test")
asdfasdfasdf
[test2.txt](file-guid:aef0eb95-b715-4707-9792-180e4395e681)';
$matches = ProsemirrorRichText::scanLinkExtension($text, 'file-guid');
static::assertCount(4, $matches);
static::assertEquals('[test2.txt](file-guid:aef0eb95-b715-4707-9792-180e4395e681)', $matches[0][0]);
static::assertEquals('test2.txt', $matches[0][1]);
static::assertEquals('file-guid', $matches[0][2]);
static::assertEquals('aef0eb95-b715-4707-9792-180e4395e681', $matches[0][3]);
static::assertEquals('![img3.jpg](file-guid:3f1e14a2-4375-434a-a554-a19ec5e48909 "img))))3.jpg")', $matches[1][0]);
static::assertEquals('img3.jpg', $matches[1][1]);
static::assertEquals('file-guid', $matches[1][2]);
static::assertEquals('3f1e14a2-4375-434a-a554-a19ec5e48909', $matches[1][3]);
static::assertEquals('img))))3.jpg', $matches[1][4]);
static::assertEquals('[test2.txt](file-guid:aef0eb95-b715-4707-9792-180e4395e681 "test")', $matches[2][0]);
static::assertEquals('test2.txt', $matches[2][1]);
static::assertEquals('file-guid', $matches[2][2]);
static::assertEquals('aef0eb95-b715-4707-9792-180e4395e681', $matches[2][3]);
static::assertEquals('test', $matches[2][4]);
static::assertEquals('[test2.txt](file-guid:aef0eb95-b715-4707-9792-180e4395e681)', $matches[3][0]);
static::assertEquals('test2.txt', $matches[3][1]);
static::assertEquals('file-guid', $matches[3][2]);
static::assertEquals('aef0eb95-b715-4707-9792-180e4395e681', $matches[3][3]);
}
}

View File

@ -1,56 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*
*/
namespace tests\codeception\unit\modules\content\widgets;
use humhub\models\UrlOembed;
use humhub\modules\content\widgets\richtext\ProsemirrorRichText;
use humhub\modules\content\widgets\richtext\RichText;
use humhub\modules\file\models\File;
use humhub\modules\post\models\Post;
use humhub\modules\user\models\User;
use tests\codeception\_support\HumHubDbTestCase;
class RichTextLinkExtensionLegacyTest extends HumHubDbTestCase
{
/**
* @throws \yii\base\InvalidConfigException
*/
public function testScanLinkExtension()
{
$match = ProsemirrorRichText::scanLinkExtension('[Text](test:id "title")', 'test');
static::assertEquals('[Text](test:id "title")', $match[0][0]);
static::assertEquals('Text', $match[0][1]);
static::assertEquals('test', $match[0][2]);
static::assertEquals('id', $match[0][3]);
static::assertEquals('title', $match[0][4]);
}
/**
* @throws \yii\base\InvalidConfigException
*/
public function testReplaceLinkExtension()
{
$resultMatch = [];
$result = ProsemirrorRichText::replaceLinkExtension('[Text](test:id "title")', 'test', function($match) use (&$resultMatch) {
$resultMatch = $match;
return 'tested';
});
static::assertEquals('tested', $result);
static::assertEquals('[Text](test:id "title")', $resultMatch[0]);
static::assertEquals('Text', $resultMatch[1]);
static::assertEquals('test', $resultMatch[2]);
static::assertEquals('id', $resultMatch[3]);
static::assertEquals('title', $resultMatch[4]);
}
}

View File

@ -1,11 +1,5 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\content\widgets\richtext;
use humhub\libs\Html;
@ -121,27 +115,6 @@ abstract class AbstractRichText extends JsWidget
*/
public $edit = false;
/**
* @var boolean enables the minimal rendering mode used for example for previews, this mode should take the
* [[maxLenght]] setting into account for truncating the preview content.
*
* @deprecated since 1.8 use shorttext converter instead
*/
public $minimal = false;
/**
* @var int setting used to truncate the rich text content, usually related to [[minimal]] mode and used for previews
*
* @deprecated since 1.8 use shorttext converter instead
*/
public $maxLength = 0;
/**
* @var boolean defines if this rich text is also used as client side markdown text.
* @deprecated since 1.3
*/
public $markdown = false;
/**
* @var array Can be used to explicitly include specific plugins in addition to the set of defaults (preset)
*/

View File

@ -1,17 +1,7 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*
*/
namespace humhub\modules\content\widgets\richtext;
use humhub\components\ActiveRecord;
use humhub\modules\content\components\ContentActiveRecord;
use humhub\modules\content\components\ContentAddonActiveRecord;
use yii\base\BaseObject;
/**

View File

@ -1,11 +1,5 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\content\widgets\richtext;
use humhub\modules\ui\form\widgets\JsInputWidget;

View File

@ -1,29 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2019 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\content\widgets\richtext;
use humhub\libs\Markdown;
/**
* Class PreviewMarkdown
* @package humhub\modules\content\widgets\richtext
* @deprecated since 1.8 use `Richtext::convert()` for richtext or a parser from `humhub\modules\content\widgets\richtext\converter` for
* plain markdown parsing.
*/
class PreviewMarkdown extends Markdown
{
protected function parseEntity($text)
{
// html entities e.g. &copy; &#169; &#x00A9;
if (preg_match('/^&#?[\w\d]+;/', $text, $matches)) {
return [['inlineHtml', $matches[0]], strlen($matches[0])];
} else {
return [['text', '&'], 1];
}
}
}

View File

@ -1,23 +1,13 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\content\widgets\richtext;
use humhub\libs\EmojiMap;
use humhub\libs\Helpers;
use humhub\libs\ParameterEvent;
use humhub\modules\content\widgets\richtext\extensions\emoji\RichTextEmojiExtension;
use humhub\modules\content\widgets\richtext\extensions\file\FileExtension;
use humhub\modules\content\widgets\richtext\extensions\link\RichTextLinkExtensionMatch;
use humhub\modules\content\widgets\richtext\extensions\mentioning\MentioningExtension;
use humhub\modules\content\widgets\richtext\extensions\oembed\OembedExtension;
use humhub\modules\content\widgets\richtext\extensions\RichTextCompatibilityExtension;
use humhub\modules\content\widgets\richtext\extensions\link\RichTextLinkExtension;
use yii\helpers\Html;
/**
@ -63,39 +53,30 @@ use yii\helpers\Html;
* See [markdown-it-anchor](https://www.npmjs.com/package/markdown-it-anchor) for more settings.
*
* ### clipboard
*
* Allows pasting of raw markdown content into the richtext editor.
*
* ### emoji
*
* [twemoji](https://github.com/twitter/twemoji) and [markdown-it-emoji](https://www.npmjs.com/package/markdown-it-emoji) based emojies
*
* ### fullscreen
*
* Adds a enlarge/shrink button to the rich text editor.
*
* ### mention
*
* Markdown link extension for mentionings in the form of [<name>](mention:<guid> "<profile-url>").
*
* ### oembed
*
* Enables scanning and replacement of pasted oembed links in form of link extensions [<url>](oembed:url)
*
* ### placeholder
*
* Text placeholder for the editor input
*
* ### strikethrough
*
* Markdown strikethrough formatting.
*
* ### table
*
* Simple Markdown table support.
*
* ### upload
*
* File upload support.
*
* @author Julian Harrer <julian.harrer@humhub.com>
@ -150,11 +131,7 @@ class ProsemirrorRichText extends AbstractRichText
*/
public function run()
{
if ($this->minimal) {
return static::convert($this->text, static::FORMAT_SHORTTEXT, ['maxLength' => $this->maxLength]);
}
$output = $this->parseOutput();
$output = $this->text;
// E.g. when initializing empty editor
if (empty($output)) {
@ -167,11 +144,6 @@ class ProsemirrorRichText extends AbstractRichText
$output = $extension->onBeforeOutput($this, $output);
}
// Can be removed in a future version, richtext should not be cut anymore, only text or shorttext version should be cut
if ($this->maxLength > 0) {
$output = Helpers::truncateText($output, $this->maxLength);
}
// Wrap encoded output in root div
$this->content = Html::encode($output);
$output = parent::run();
@ -184,53 +156,4 @@ class ProsemirrorRichText extends AbstractRichText
return trim($output);
}
/**
* Prior of 1.8 this function was used for preparing the richtext output. In 1.8 we richtext extensions should be
* used to manipulate the richtext output.
*
* @return string
* @deprecated since 1.8 use `RichTextExtension::onBeforeOutput()` to manipulate output
*/
protected function parseOutput()
{
return $this->text;
}
/**
* Can be used to scan for link extensions of the form [<text>](<extension>:<url> "<title>") in which the actual meaning
* of the placeholders is up to the extension itself.
*
* @param $text string rich text content to parse
* @param $extension string|null extension string if not given all extension types will be included
* @return array
* @deprecated since 1.8 use `ProsemirrorRichTextConverter::scanLinkExtension()`
*/
public static function scanLinkExtension($text, $extension = null)
{
$matches = [];
$result = RichTextLinkExtension::scanLinkExtension($text, $extension);
foreach ($result as $match) {
$matches[] = $match->match;
}
return $matches;
}
/**
* Can be used to scan and replace link extensions of the form [<text>](<extension>:<url> "<title>") in which the actual meaning
* of the placeholders is up to the extension itself.
*
* @param string|null $text string rich text content to parse
* @param string|null $extension extension string if not given all extension types will be included
* @param callable $callback
* @return mixed
* @deprecated since 1.8 use `ProsemirrorRichTextConverter::replaceLinkExtension()`
*/
public static function replaceLinkExtension(?string $text, ?string $extension, callable $callback)
{
return RichTextLinkExtension::replaceLinkExtension($text, $extension, function (RichTextLinkExtensionMatch $match) use ($callback) {
return $callback($match->match);
});
}
}

View File

@ -1,9 +1,7 @@
<?php
namespace humhub\modules\content\widgets\richtext;
use humhub\modules\content\widgets\richtext\converter\RichTextToHtmlConverter;
use humhub\modules\content\widgets\richtext\converter\RichTextToMarkdownConverter;
use humhub\modules\content\widgets\richtext\converter\RichTextToPlainTextConverter;

View File

@ -1,14 +1,7 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\content\widgets\richtext;
use humhub\modules\content\assets\ProseMirrorRichTextAsset;
use humhub\modules\file\widgets\UploadInput;
/**

View File

@ -1,11 +1,5 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\content\widgets\richtext;
use Yii;

View File

@ -1,11 +1,5 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\content\widgets\richtext;
use Yii;

View File

@ -1,13 +1,7 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2020 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\content\widgets\richtext\converter;
use cebe\markdown\GithubMarkdown;
use humhub\components\ActiveRecord;
use humhub\components\Event;
@ -19,22 +13,20 @@ use humhub\modules\content\widgets\richtext\extensions\link\RichTextLinkExtensio
use humhub\modules\content\widgets\richtext\extensions\RichTextExtension;
use humhub\modules\content\widgets\richtext\ProsemirrorRichText;
use Yii;
use yii\base\InvalidArgumentException;
/**
* This class serves as base class for richtext converters used to convert HumHub richtext to other formats. The base
* converter class extends GithubMarkdown markdown parser to support:
* This class serves as base class for richtext converters used to convert HumHub richtext to other formats.
*
* - `onBeforeParse` and `onAfterparse` events
* The base converter class extends GithubMarkdown Markdown parser to support:
* - `onBeforeParse` and `onAfterParse` events
* - new line by `\`
* - registration of richtext extensions
* - extended link/image regex e.g. for image size [Scaled Image](http://localhost/static/img/logo.png =150x)
*
* The [[addExtension()]] function can be used to add additional richtext extensions. By default all extensions registered
* in [[ProsemirrorRichText::getExtensions()]] are available.
* The [[addExtension()]] function can be used to add additional richtext extensions.
* By default, all extensions registered in [[ProsemirrorRichText::getExtensions()]] are available.
*
* > Note: The result of this parser will not be encoded, so do not directly add the result to a HTML view without
* encoding it.
* > Note: The result of this parser will not be encoded, so do not directly add the result to a HTML view without encoding it.
*
* @since 1.8
*/
@ -176,7 +168,7 @@ abstract class BaseRichTextConverter extends GithubMarkdown
}
$result = 'content_' . $content->content->id;
return $prefix ? $prefix.'_'.$result : $result;
return $prefix ? $prefix . '_' . $result : $result;
}
/**
@ -192,8 +184,8 @@ abstract class BaseRichTextConverter extends GithubMarkdown
*/
public static function buildCacheKeyForRecord(ActiveRecord $record, $prefix = null)
{
$result = get_class($record).'_'.$record->getUniqueId();
return $prefix ? $prefix.'_'.$result : $result;
$result = get_class($record) . '_' . $record->getUniqueId();
return $prefix ? $prefix . '_' . $result : $result;
}
/**
@ -208,9 +200,10 @@ abstract class BaseRichTextConverter extends GithubMarkdown
* Can be used to add additional richtext extensions
* @param RichTextExtension $extension
*/
public function addExtension(RichTextExtension $extension) {
public function addExtension(RichTextExtension $extension)
{
$this->extensions[] = $extension;
if($extension instanceof RichTextLinkExtension) {
if ($extension instanceof RichTextLinkExtension) {
$this->linkExtensions[] = $extension;
}
}
@ -224,17 +217,17 @@ abstract class BaseRichTextConverter extends GithubMarkdown
$result = null;
$cacheKey = $this->getOption(static::OPTION_CACHE_KEY, null);
if($cacheKey && isset(static::$cache[$cacheKey])) {
if ($cacheKey && isset(static::$cache[$cacheKey])) {
$result = static::$cache[$cacheKey];
}
if($result === null) {
if ($result === null) {
$result = $this->onBeforeParse($text);
$result = parent::parse($result);
// We cache the whole parser result, this way we can reuse the same result e.g. for different maxLength
// or other post processes
if($cacheKey && count(static::$cache) < static::MAX_CACHE_ENTRIES) {
if ($cacheKey && count(static::$cache) < static::MAX_CACHE_ENTRIES) {
static::$cache[$cacheKey] = $result;
}
}
@ -273,7 +266,7 @@ abstract class BaseRichTextConverter extends GithubMarkdown
$text = $evt->result;
// Remove leading new backslash new lines e.g. "Test\\\n" -> "Test"
$text = preg_replace('/\\\\(\n|\r){1,2}$/', '', $text);
$text = preg_replace('/\\\\(\n|\r){1,2}$/', '', $text);
foreach ($this->extensions as $extension) {
$text = $extension->onBeforeConvert($text, $this->format, $this->options);
@ -284,8 +277,8 @@ abstract class BaseRichTextConverter extends GithubMarkdown
protected function renderAbsy($blocks)
{
if(!empty($this->getExcludes())) {
$blocks = array_filter($blocks, function($block) {
if (!empty($this->getExcludes())) {
$blocks = array_filter($blocks, function ($block) {
return !in_array($block[0], $this->getExcludes(), true);
});
}
@ -308,12 +301,10 @@ abstract class BaseRichTextConverter extends GithubMarkdown
* return $text;
* }
* ```
*
*
* @param $text
* @return mixed|string
*/
protected function onAfterParse($text) : string
protected function onAfterParse($text): string
{
$evt = new Event(['result' => $text]);
Event::trigger($this, static::EVENT_AFTER_PARSE, $evt);
@ -373,7 +364,7 @@ REGEXP;
return [
$text,
isset($refMatches[2]) ? $refMatches[2] : '', // url
empty($refMatches[5]) ? null: $refMatches[5], // title
empty($refMatches[5]) ? null : $refMatches[5], // title
$offset + strlen($refMatches[0]), // offset
null, // reference key
empty($refMatches[7]) ? null : $refMatches[7] // extension metadata
@ -409,24 +400,24 @@ REGEXP;
*/
protected function renderLink($block)
{
return $this->renderLinkOrImage(new LinkParserBlock([
'block' => $block,
'parsedText' => is_string($block['text']) ? $block['text'] : $this->renderAbsy($block['text'])
]));
return $this->renderLinkOrImage(new LinkParserBlock([
'block' => $block,
'parsedText' => is_string($block['text']) ? $block['text'] : $this->renderAbsy($block['text'])
]));
}
protected function renderLinkOrImage(LinkParserBlock $linkBlock)
{
if(!$linkBlock->getUrl()) {
if (!$linkBlock->getUrl()) {
return $linkBlock->getParsedText();
}
foreach ($this->linkExtensions as $linkExtension) {
if(in_array($linkExtension->key, $this->getExcludes())) {
if (in_array($linkExtension->key, $this->getExcludes())) {
return '';
}
if($linkExtension->validateExtensionUrl($linkBlock->getUrl())) {
if ($linkExtension->validateExtensionUrl($linkBlock->getUrl())) {
$linkExtension->onBeforeConvertLink($linkBlock);
$linkBlock->toAbsoluteUrl();
return $this->renderLinkExtension($linkExtension, $linkBlock);
@ -435,7 +426,7 @@ REGEXP;
$linkBlock->toAbsoluteUrl();
if($linkBlock->isImage()) {
if ($linkBlock->isImage()) {
return $this->renderPlainImage($linkBlock);
}
@ -459,11 +450,11 @@ REGEXP;
// Remove image alignment extension from image alt text
$block['text'] = preg_replace('/>?<?$/', '', $text);
if($this->getOption(static::OPTION_IMAGE_AS_URL, false)) {
if ($this->getOption(static::OPTION_IMAGE_AS_URL, false)) {
return Html::encode($block['url']);
}
if($this->getOption(static::OPTION_IMAGE_AS_LINK, false)) {
if ($this->getOption(static::OPTION_IMAGE_AS_LINK, false)) {
$text = empty($block['text']) ? $block['url'] : $block['text'];
$linkBlock = $block;
$linkBlock[0] = 'link';
@ -483,12 +474,13 @@ REGEXP;
* @param LinkParserBlock $linkBlock
* @return string
*/
protected function renderLinkExtension(RichTextLinkExtension $ext, LinkParserBlock $linkBlock) : string {
if($linkBlock->getResult()) {
protected function renderLinkExtension(RichTextLinkExtension $ext, LinkParserBlock $linkBlock): string
{
if ($linkBlock->getResult()) {
return $linkBlock->getResult();
}
if($linkBlock->isImage()) {
if ($linkBlock->isImage()) {
return $this->renderPlainImage($linkBlock);
}
@ -499,7 +491,8 @@ REGEXP;
* @param LinkParserBlock $linkBlock
* @return string
*/
protected function renderPlainLink(LinkParserBlock $linkBlock) : string {
protected function renderPlainLink(LinkParserBlock $linkBlock): string
{
$block = $linkBlock->block;
if (isset($block['refkey'])) {
@ -510,14 +503,14 @@ REGEXP;
}
}
if($this->getOption(static::OPTION_LINK_AS_TEXT, false)) {
if ($this->getOption(static::OPTION_LINK_AS_TEXT, false)) {
return $this->renderAbsy($block['text']);
}
$target = Html::encode($this->getOption(static::OPTION_LINK_TARGET, '_blank'));
$targetAttr = !$this->getOption(static::OPTION_PREV_LINK_TARGET, false) ? " target=\"$target\"" : '';
return '<a href="' . htmlspecialchars($block['url'], ENT_COMPAT | ENT_HTML401, 'UTF-8') . '"'. $targetAttr
return '<a href="' . htmlspecialchars($block['url'], ENT_COMPAT | ENT_HTML401, 'UTF-8') . '"' . $targetAttr
. (empty($block['title']) ? '' : ' title="' . htmlspecialchars($block['title'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE, 'UTF-8') . '"')
. '>' . $this->renderAbsy($block['text']) . '</a>';
}
@ -526,7 +519,8 @@ REGEXP;
* @param LinkParserBlock $linkBlock
* @return string
*/
protected function renderPlainImage(LinkParserBlock $linkBlock) : string {
protected function renderPlainImage(LinkParserBlock $linkBlock): string
{
return parent::renderImage($linkBlock->block);
}
@ -559,4 +553,4 @@ REGEXP;
return $result;
}
}
}

View File

@ -1,11 +1,5 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2021 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\content\widgets\richtext\converter;
use humhub\libs\Html;
@ -15,8 +9,8 @@ use humhub\modules\file\models\File;
use humhub\modules\user\models\User;
/**
* This parser can be used to convert HumHub richtext directly to email html in order to view images from email inbox where
* user is not logged in so access is restricted.
* This parser can be used to convert HumHub richtext directly to email html in order to view images
* from email inbox where user is not logged in so access is restricted.
*
* @since 1.8.2
*/

View File

@ -1,23 +1,10 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2020 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\content\widgets\richtext\converter;
use cebe\markdown\GithubMarkdown;
use cebe\markdown\inline\LinkTrait;
use humhub\libs\Html;
use humhub\modules\content\widgets\richtext\extensions\link\RichTextLinkExtension;
use humhub\modules\content\widgets\richtext\extensions\link\RichTextLinkExtensionMatch;
use humhub\modules\content\widgets\richtext\extensions\RichTextExtension;
use humhub\modules\content\widgets\richtext\ProsemirrorRichText;
use yii\helpers\HtmlPurifier;
use yii\helpers\Url;
/**
* This parser can be used to convert HumHub richtext directly to html. Note, this parser will only output html supported
@ -28,7 +15,6 @@ use yii\helpers\Url;
* The output parser output will be purified and can safely be used.
*
* Available options:
*
* - `exclude`: Exclude certain blocks or extensions from being rendered
* - `linkTarget`: Change link `target` (default `_blank`)
* - `prevLinkTarget`: Removes `target` and `rel` attribute from all links
@ -41,7 +27,7 @@ class RichTextToHtmlConverter extends BaseRichTextConverter
/**
* @var string HtmlPurifier HTML.Doctype configuration
*/
public $doctype = 'HTML 4.01 Transitional';
public $doctype = 'HTML 4.01 Transitional';
/**
* @var string HtmlPurifier URI.AllowedSchemes configuration
@ -76,11 +62,11 @@ class RichTextToHtmlConverter extends BaseRichTextConverter
/**
* @inheritDoc
*/
protected function onAfterParse($text) : string
protected function onAfterParse($text): string
{
$text = parent::onAfterParse($text);
if(!$this->purify) {
if (!$this->purify) {
return $text;
}
@ -88,13 +74,13 @@ class RichTextToHtmlConverter extends BaseRichTextConverter
// Make sure we use non xhtml tags, unfortunately HTML5 is not supported by html purifier
$config->set('HTML.Doctype', $this->doctype);
if(!$this->getOption('prevLinkTarget', false)) {
if (!$this->getOption('prevLinkTarget', false)) {
$config->set('HTML.Nofollow', true);
}
$config->set('HTML.Allowed', $this->htmlAllowed);
$config->set('HTML.AllowedAttributes', $this->htmlAllowedAttributes);
$config->set('URI.AllowedSchemes',$this->allowedSchemes);
$config->set('URI.AllowedSchemes', $this->allowedSchemes);
$htmlDefinition = $config->getHTMLDefinition(true);
@ -113,7 +99,6 @@ class RichTextToHtmlConverter extends BaseRichTextConverter
}
/**
* @param $block
* @return string
@ -132,7 +117,7 @@ class RichTextToHtmlConverter extends BaseRichTextConverter
protected function renderInlineHtml($block)
{
// We only support <br> tags
if($block[1] === '<br>' || $block[1] === '<br />') {
if ($block[1] === '<br>' || $block[1] === '<br />') {
return '<br>';
}
@ -147,6 +132,6 @@ class RichTextToHtmlConverter extends BaseRichTextConverter
protected function renderHtml($block)
{
// We do not support direct html in richtext markdown
return '<p>'.nl2br(Html::encode($this->br2nl($block['content']))).'</p>';
return '<p>' . nl2br(Html::encode($this->br2nl($block['content']))) . '</p>';
}
}

View File

@ -1,9 +1,4 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2020 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\content\widgets\richtext\converter;
@ -77,7 +72,7 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
/**
* @inheritDoc
*/
protected function onAfterParse($text) : string
protected function onAfterParse($text): string
{
return trim(parent::onAfterParse($text));
}
@ -85,33 +80,40 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
/**
* html entity mark parser is disabled by removing marker in php doc
*/
protected function parseEntity($text) { /* Not implemented */}
protected function parseEntity($text)
{ /* Not implemented */
}
/**
* `<` mark parser is disabled by removing marker in php doc
*/
protected function parseLt($text) { /* Not implemented */}
protected function parseLt($text)
{ /* Not implemented */
}
/**
* `>` mark parser is disabled by removing marker in php doc
*/
protected function parseGt($text) { /* Not implemented */}
protected function parseGt($text)
{ /* Not implemented */
}
/**
* @inheritDoc
*/
protected function renderPlainLink(LinkParserBlock $linkBlock) : string
protected function renderPlainLink(LinkParserBlock $linkBlock): string
{
return RichTextLinkExtension::buildLink($linkBlock->getParsedText(),$linkBlock->getUrl(), $linkBlock->getTitle());
return RichTextLinkExtension::buildLink($linkBlock->getParsedText(), $linkBlock->getUrl(), $linkBlock->getTitle());
}
/**
* @inheritDoc
*/
protected function renderPlainImage(LinkParserBlock $linkBlock) : string {
protected function renderPlainImage(LinkParserBlock $linkBlock): string
{
$result = $this->renderPlainLink($linkBlock);
return $result[0] === '[' ? static::IMAGE_SUFFIX.$result : $result;
return $result[0] === '[' ? static::IMAGE_SUFFIX . $result : $result;
}
/**
@ -121,7 +123,7 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
*/
protected function renderEmail($block)
{
return RichTextLinkExtension::buildLink($block[1], 'mailto:'.$block[1]);
return RichTextLinkExtension::buildLink($block[1], 'mailto:' . $block[1]);
}
/**
@ -155,14 +157,14 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
*/
protected function renderParagraph($block)
{
return $this->renderAbsy($block['content'])."\n\n";
return $this->renderAbsy($block['content']) . "\n\n";
}
/**
* Returns a plain text representation of a list block
* @param $block
* @return string
*/
*/
protected function renderList($block)
{
$output = '';
@ -170,16 +172,16 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
$level = $block['level'] ?? 0;
foreach ($block['items'] as $item => $itemLines) {
foreach ($itemLines as &$line) {
if($line[0] === 'list') {
if ($line[0] === 'list') {
$line['level'] = $level + 1;
}
}
unset( $line );
unset($line);
$output .= $level !== 0 ? "\n".str_repeat(' ', $level * 3) : '';
$output .= $block['list'] === 'ol' ? (isset($block['origNums'][$item]) ? $block['origNums'][$item] : ++$count).'. ' : '- ';
$output .= $this->renderAbsy($itemLines). ($level === 0 ? "\n" : '');
$output .= $level !== 0 ? "\n" . str_repeat(' ', $level * 3) : '';
$output .= $block['list'] === 'ol' ? (isset($block['origNums'][$item]) ? $block['origNums'][$item] : ++$count) . '. ' : '- ';
$output .= $this->renderAbsy($itemLines) . ($level === 0 ? "\n" : '');
}
return $output . ($level === 0 ? "\n" : '');
@ -192,7 +194,7 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
protected function renderCode($block)
{
$lang = $block['language'] ?? '';
return "```$lang\n".$block['content']."\n```\n\n";
return "```$lang\n" . $block['content'] . "\n```\n\n";
}
/**
@ -201,7 +203,7 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
*/
protected function renderQuote($block)
{
return '> '.$this->renderAbsy($block['content']) . "\n\n";
return '> ' . $this->renderAbsy($block['content']) . "\n\n";
}
/**
@ -210,7 +212,7 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
*/
protected function renderHeadline($block)
{
return str_repeat('#', $block['level']).' '.$this->renderAbsy($block['content'])."\n\n";
return str_repeat('#', $block['level']) . ' ' . $this->renderAbsy($block['content']) . "\n\n";
}
/**
@ -220,7 +222,7 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
protected function renderHtml($block)
{
// We do not strip_tags here, since the richtext does not support html and interprets html as normal text
return $this->br2nl($block['content']). "\n\n";
return $this->br2nl($block['content']) . "\n\n";
}
/**
@ -244,7 +246,7 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
*/
protected function renderStrike($block)
{
return static::STRIKE_WRAPPER.$this->renderAbsy($block[1]).static::STRIKE_WRAPPER;
return static::STRIKE_WRAPPER . $this->renderAbsy($block[1]) . static::STRIKE_WRAPPER;
}
/**
@ -253,7 +255,7 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
*/
protected function renderStrong($block)
{
return static::BOLD_WRAPPER.$this->renderAbsy($block[1]).static::BOLD_WRAPPER;
return static::BOLD_WRAPPER . $this->renderAbsy($block[1]) . static::BOLD_WRAPPER;
}
/**
@ -262,7 +264,7 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
*/
protected function renderEmph($block)
{
return static::EMPHASIZE_WRAPPER.$this->renderAbsy($block[1]).static::EMPHASIZE_WRAPPER;
return static::EMPHASIZE_WRAPPER . $this->renderAbsy($block[1]) . static::EMPHASIZE_WRAPPER;
}
/**
@ -271,7 +273,7 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
*/
protected function renderInlineCode($block)
{
return static::INLINE_CODE_WRAPPER.$block[1].static::INLINE_CODE_WRAPPER;
return static::INLINE_CODE_WRAPPER . $block[1] . static::INLINE_CODE_WRAPPER;
}
/**
@ -317,14 +319,14 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
*/
protected function identifyQuote($line)
{
return $this->identifyQuote
? parent::identifyQuote($line)
: false;
return $this->identifyQuote && parent::identifyQuote($line);
}
/**
* Deactivated by removing marker
*/
protected function parseTd($markdown) { /* Not implemented */ }
protected function parseTd($markdown)
{ /* Not implemented */
}
}

View File

@ -1,22 +1,11 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2020 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\content\widgets\richtext\converter;
use cebe\markdown\GithubMarkdown;
use cebe\markdown\inline\LinkTrait;
use humhub\libs\Helpers;
use humhub\modules\content\widgets\richtext\extensions\link\LinkParserBlock;
use humhub\modules\content\widgets\richtext\extensions\link\RichTextLinkExtension;
use humhub\modules\content\widgets\richtext\extensions\link\RichTextLinkExtensionMatch;
use humhub\modules\content\widgets\richtext\extensions\RichTextExtension;
use humhub\modules\content\widgets\richtext\ProsemirrorRichText;
use yii\helpers\Url;
/**
* This parser can be used to convert richtext or plain markdown to a plain text format used for example in
@ -91,9 +80,9 @@ class RichTextToPlainTextConverter extends RichTextToMarkdownConverter
/**
* @inheritDoc
*/
protected function renderPlainLink(LinkParserBlock $linkBlock) : string
protected function renderPlainLink(LinkParserBlock $linkBlock): string
{
if($linkBlock->getParsedText() === $linkBlock->getUrl()) {
if ($linkBlock->getParsedText() === $linkBlock->getUrl()) {
return $linkBlock->getUrl();
}
@ -110,14 +99,14 @@ class RichTextToPlainTextConverter extends RichTextToMarkdownConverter
$maxLength = $this->getOption(static::OPTION_MAX_LENGTH, 0);
// In case of a given cache key, we need to make sure to parse and cache the full text
if(!$maxLength || $this->getOption(static::OPTION_CACHE_KEY, null)) {
if (!$maxLength || $this->getOption(static::OPTION_CACHE_KEY, null)) {
return $paragraph;
}
foreach ($paragraph as $inline) {
if(isset($inline[0], $inline[1]) && $inline[0] === 'text') {
if (isset($inline[0], $inline[1]) && $inline[0] === 'text') {
$this->textCount += mb_strlen($inline[1]);
if($this->textCount > $maxLength) {
if ($this->textCount > $maxLength) {
$this->skipBlocks = true;
}
}
@ -131,7 +120,7 @@ class RichTextToPlainTextConverter extends RichTextToMarkdownConverter
*/
protected function parseBlock($lines, $current)
{
if($this->skipBlocks) {
if ($this->skipBlocks) {
return [false, count($lines)];
}
@ -146,7 +135,8 @@ class RichTextToPlainTextConverter extends RichTextToMarkdownConverter
/**
* @inheritDoc
*/
protected function renderPlainImage(LinkParserBlock $linkBlock) : string {
protected function renderPlainImage(LinkParserBlock $linkBlock): string
{
return $this->renderPlainLink($linkBlock);
}
@ -186,12 +176,12 @@ class RichTextToPlainTextConverter extends RichTextToMarkdownConverter
/**
* @inheritDoc
*/
protected function onAfterParse($text) : string
protected function onAfterParse($text): string
{
$result = parent::onAfterParse($text);
$maxLength = $this->getOption(static::OPTION_MAX_LENGTH, 0);
if($maxLength > 0) {
if ($maxLength > 0) {
$result = Helpers::truncateText($result, $maxLength);
}

View File

@ -1,10 +1,7 @@
<?php
namespace humhub\modules\content\widgets\richtext\converter;
use humhub\libs\Helpers;
use humhub\libs\Html;
use humhub\modules\content\widgets\richtext\extensions\link\LinkParserBlock;
use humhub\modules\content\widgets\richtext\extensions\link\RichTextLinkExtension;
@ -47,7 +44,7 @@ class RichTextToShortTextConverter extends RichTextToPlainTextConverter
/**
* @inheritDoc
*/
protected function renderPlainLink(LinkParserBlock $linkBlock) : string
protected function renderPlainLink(LinkParserBlock $linkBlock): string
{
return $linkBlock->getParsedText();
}
@ -74,7 +71,7 @@ class RichTextToShortTextConverter extends RichTextToPlainTextConverter
*/
protected function renderCode($block)
{
return Yii::t('ContentModule.richtexteditor', '[Code Block]')."\n\n";
return Yii::t('ContentModule.richtexteditor', '[Code Block]') . "\n\n";
}
/**
@ -82,7 +79,7 @@ class RichTextToShortTextConverter extends RichTextToPlainTextConverter
*/
protected function renderTable($block)
{
return Yii::t('ContentModule.richtexteditor', '[Table]')."\n\n";
return Yii::t('ContentModule.richtexteditor', '[Table]') . "\n\n";
}
/**
@ -90,7 +87,7 @@ class RichTextToShortTextConverter extends RichTextToPlainTextConverter
*/
protected function renderHeadline($block)
{
return $this->renderAbsy($block['content'])."\n\n";
return $this->renderAbsy($block['content']) . "\n\n";
}
/**
@ -99,13 +96,13 @@ class RichTextToShortTextConverter extends RichTextToPlainTextConverter
*/
protected function renderImage($block)
{
return Yii::t('ContentModule.richtexteditor', '[Image]')."\n\n";
return Yii::t('ContentModule.richtexteditor', '[Image]') . "\n\n";
}
/**
* @inheritDoc
*/
protected function renderPlainImage(LinkParserBlock $linkBlock) : string
protected function renderPlainImage(LinkParserBlock $linkBlock): string
{
$url = $linkBlock->getUrl();
return RichTextLinkExtension::validateNonExtensionUrl($url) ? $url : '';
@ -114,18 +111,18 @@ class RichTextToShortTextConverter extends RichTextToPlainTextConverter
/**
* @inheritDoc
*/
protected function onAfterParse($text) : string
protected function onAfterParse($text): string
{
$result = $text;
if(!$this->getOption(static::OPTION_PRESERVE_SPACES, false)) {
$result = trim(preg_replace('/\s+/', ' ', $result));
if (!$this->getOption(static::OPTION_PRESERVE_SPACES, false)) {
$result = trim(preg_replace('/\s+/', ' ', $result));
}
$result = parent::onAfterParse($result);
$result = Html::encode($result);
if($this->getOption(static::OPTION_NL2BR, false)) {
if ($this->getOption(static::OPTION_NL2BR, false)) {
$result = nl2br($result, false);
}

View File

@ -1,9 +1,7 @@
<?php
namespace humhub\modules\content\widgets\richtext\extensions;
use humhub\components\ActiveRecord;
use humhub\models\UrlOembed;
use humhub\modules\content\Module;
@ -20,8 +18,6 @@ use yii\helpers\Html;
* The legacy format uses a different syntax for emoji, mentioning, oembed.
*
* This conversion can be deactivated either by module configuration or by module db setting `richtextCompatMode`.
*
* @package humhub\modules\content\widgets\richtext\extensions
*/
class RichTextCompatibilityExtension extends Model implements RichTextExtension
{
@ -35,7 +31,7 @@ class RichTextCompatibilityExtension extends Model implements RichTextExtension
*/
public function onBeforeOutput(ProsemirrorRichText $richtext, string $output): string
{
if(!$this->isCompatibilityMode()) {
if (!$this->isCompatibilityMode()) {
return $output;
}
@ -51,7 +47,7 @@ class RichTextCompatibilityExtension extends Model implements RichTextExtension
* @param string $show show smilies or remove it (for activities and notifications)
* @return string
*/
public static function translateEmojis(string $text) : string
public static function translateEmojis(string $text): string
{
$emojis = [
"Relaxed", "Yum", "Relieved", "Hearteyes", "Cool", "Smirk",
@ -111,7 +107,7 @@ class RichTextCompatibilityExtension extends Model implements RichTextExtension
* @param $text
* @return mixed
*/
private static function translateLinks(string $text) : string
private static function translateLinks(string $text): string
{
return preg_replace_callback('/(?<=^|\s)(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s\]\)\\"\'\<]{2,})(?=$|\s)/', function ($hit) {
$url = $hit[0];
@ -125,7 +121,7 @@ class RichTextCompatibilityExtension extends Model implements RichTextExtension
* @param $text
* @return mixed
*/
private static function translateMentionings(string $text) : string
private static function translateMentionings(string $text): string
{
return preg_replace_callback('@\@\-([us])([\w\-]*?)($|[\.,:;\'"!\?\s])@', function ($hit) {
if ($hit[1] == 'u') {
@ -152,7 +148,7 @@ class RichTextCompatibilityExtension extends Model implements RichTextExtension
*/
private function isCompatibilityMode()
{
/* @var $module Module */
/* @var $module Module */
$module = Yii::$app->getModule('content');
return $module->richtextCompatMode && $module->settings->get(static::DB_SETTING_KEY, 1);
}

View File

@ -1,9 +1,7 @@
<?php
namespace humhub\modules\content\widgets\richtext\extensions;
use humhub\modules\content\widgets\richtext\ProsemirrorRichText;
use yii\base\Model;
use humhub\components\ActiveRecord;
@ -30,13 +28,13 @@ abstract class RichTextContentExtension extends Model implements RichTextExtensi
* @param RichTextExtensionMatch $match
* @return string
*/
public abstract function initMatch(array $match) : RichTextExtensionMatch;
public abstract function initMatch(array $match): RichTextExtensionMatch;
/**
* @param array $match
* @return string
*/
public abstract function getRegex() : string;
public abstract function getRegex(): string;
/**
* @param $text
@ -51,7 +49,7 @@ abstract class RichTextContentExtension extends Model implements RichTextExtensi
* @param $text
* @return string
*/
public static function replace($text, callable $callback) : string
public static function replace($text, callable $callback): string
{
return static::instance()->replaceExtension($text, $callback);
}
@ -78,7 +76,7 @@ abstract class RichTextContentExtension extends Model implements RichTextExtensi
*/
protected function replaceExtension($text, callable $callback)
{
return preg_replace_callback($this->getRegex(), function($match) use ($callback) {
return preg_replace_callback($this->getRegex(), function ($match) use ($callback) {
return $callback($this->initMatch($match));
}, $text);
}
@ -88,11 +86,13 @@ abstract class RichTextContentExtension extends Model implements RichTextExtensi
return $text;
}
public function onBeforeOutput(ProsemirrorRichText $richtext, string $output): string {
public function onBeforeOutput(ProsemirrorRichText $richtext, string $output): string
{
return $output;
}
public function onAfterOutput(ProsemirrorRichText $richtext, string $output): string {
public function onAfterOutput(ProsemirrorRichText $richtext, string $output): string
{
return $output;
}
}

View File

@ -1,9 +1,7 @@
<?php
namespace humhub\modules\content\widgets\richtext\extensions;
use humhub\modules\content\widgets\richtext\ProsemirrorRichText;
use humhub\components\ActiveRecord;

View File

@ -1,16 +1,12 @@
<?php
namespace humhub\modules\content\widgets\richtext\extensions;
use yii\base\Model;
/**
* A RichTextExtensionMatch wraps regex results of richtext extensions and provides helper functions to access
* data of a match.
*
* @package humhub\modules\content\widgets\richtext\extensions
*/
abstract class RichTextExtensionMatch extends Model
{
@ -23,26 +19,26 @@ abstract class RichTextExtensionMatch extends Model
* Returns the full match string
* @return string
*/
public abstract function getFull() : string;
public abstract function getFull(): string;
/**
* Returns the extension key
* @return string
*/
public abstract function getExtensionKey() : string;
public abstract function getExtensionKey(): string;
/**
* Returns the id of this extension match, the id usually identifies this instance e.g. an url
* @return string
*/
public abstract function getExtensionId() : ?string;
public abstract function getExtensionId(): ?string;
/**
* Returns the value of a given match index or null
* @param $index
* @return string|null
*/
public function getByIndex(int $index) : ?string
public function getByIndex(int $index): ?string
{
return $this->match[$index] ?? null;
}

View File

@ -11,12 +11,9 @@ use humhub\components\ActiveRecord;
/**
* The emoji richtext extension is responsible for replacing richtext emoji syntax like :smile: to utf8 characters when
* converting a richtext to other formats.
*
* @package humhub\modules\content\widgets\richtext\extensions\emoji
*/
class RichTextEmojiExtension extends RichTextContentExtension
{
/**
* @inheritdoc
*/
@ -25,7 +22,8 @@ class RichTextEmojiExtension extends RichTextContentExtension
/**
* @inheritdoc
*/
public function onBeforeConvert(string $text, string $format, array $options = []) : string {
public function onBeforeConvert(string $text, string $format, array $options = []): string
{
return static::convertEmojiToUtf8($text);
}
@ -33,11 +31,11 @@ class RichTextEmojiExtension extends RichTextContentExtension
* @param $text
* @return string
*/
public static function convertEmojiToUtf8($text) : string
public static function convertEmojiToUtf8($text): string
{
// Note the ; was used in the legacy editor
return static::replace($text, function(RichTextEmojiExtensionMatch $match) {
if(!empty($match->getEmojiName())) {
return static::replace($text, function (RichTextEmojiExtensionMatch $match) {
if (!empty($match->getEmojiName())) {
$name = $match->getEmojiName();
return array_key_exists(strtolower($name), EmojiMap::MAP)
? EmojiMap::MAP[strtolower($name)]

View File

@ -1,22 +1,16 @@
<?php
namespace humhub\modules\content\widgets\richtext\extensions\emoji;
use humhub\libs\EmojiMap;
use humhub\modules\content\widgets\richtext\extensions\RichTextExtensionMatch;
/**
* Richtext emoji extension match contains the result of the following emoji format:
*
* :<emojiName>:
*
* @package humhub\modules\content\widgets\richtext\extensions\emoji
*/
class RichTextEmojiExtensionMatch extends RichTextExtensionMatch
{
/**
* Returns the full match string
* @return string

View File

@ -16,7 +16,6 @@ use yii\web\UploadedFile;
* This LinkExtension is used to represent mentionings in the richtext as:
*
* [<name>](mention:<guid> "<url>")
*
*/
class FileExtension extends RichTextLinkExtension
{
@ -25,13 +24,13 @@ class FileExtension extends RichTextLinkExtension
/**
* @inheritDoc
*/
public function onBeforeConvertLink(LinkParserBlock $linkBlock) : void
public function onBeforeConvertLink(LinkParserBlock $linkBlock): void
{
$guid = $this->cutExtensionKeyFromUrl($linkBlock->getUrl());
$file = File::findOne(['guid' => $guid]);
if(!$file) {
if (!$file) {
$linkBlock->setResult($linkBlock->getParsedText());
return;
}
@ -39,15 +38,15 @@ class FileExtension extends RichTextLinkExtension
$linkBlock->setBlock($linkBlock->getParsedText(), $file->getUrl(), null, $file->id);
}
public static function buildFileLink(File $file) : string
public static function buildFileLink(File $file): string
{
return static::buildLink($file->file_name, 'file-guid:'.$file->guid, $file->getUrl([], true));
return static::buildLink($file->file_name, 'file-guid:' . $file->guid, $file->getUrl([], true));
}
public static function buildFileNotFound($name, $guid) : string
public static function buildFileNotFound($name, $guid): string
{
return '['.$name.'](mention:'.$guid.' "#")';
return '[' . $name . '](mention:' . $guid . ' "#")';
}
public function onBeforeConvert(string $text, string $format, array $options = []): string
@ -57,24 +56,24 @@ class FileExtension extends RichTextLinkExtension
public function onPostProcess(string $text, ActiveRecord $record, ?string $attribute, array &$result): string
{
if($record->isNewRecord) {
if ($record->isNewRecord) {
// We can't attach files to unpersisted records
return $text;
}
$result[$this->key] = [];
foreach ($this->scanExtension($text) as $match) {
if($match->getExtensionId()) {
if($this->attach($record, $match->getExtensionId())) {
if ($match->getExtensionId()) {
if ($this->attach($record, $match->getExtensionId())) {
$result[$this->key][] = $match->getExtensionId();
}
}
}
$text = static::replaceLinkExtension($text, 'data', function(RichTextLinkExtensionMatch $match) use($record, &$result) {
if($match->getExtensionId()) {
$text = static::replaceLinkExtension($text, 'data', function (RichTextLinkExtensionMatch $match) use ($record, &$result) {
if ($match->getExtensionId()) {
$file = $this->parseBase64Data($match->getExtensionId(), $record);
if($file && $file->guid) {
if ($file && $file->guid) {
$result[$this->key][] = $file->guid;
//return '['.$file->file_name.'](file-guid:'.$file->guid.' "'.$file->file_name.'"'.(isset($match[4]) ? $match[4] : '').')';
return $this->buildExtensionLink($file->file_name, $file->guid, $file->file_name, $match->getAddition());
@ -95,7 +94,7 @@ class FileExtension extends RichTextLinkExtension
try {
$file = File::findOne(['guid' => $fileGuid]);
if(!$file) {
if (!$file) {
return false;
}
@ -118,26 +117,26 @@ class FileExtension extends RichTextLinkExtension
try {
preg_match('/^([-\w.]+\/[-\w.+]+);([^,]+),([a-zA-Z0-9\/\r\n+]*={0,2})$/s', $dataStr, $matches);
if(!isset($matches[1]) || !isset($matches[3])) {
if (!isset($matches[1]) || !isset($matches[3])) {
return false;
}
$mime = $matches[1];
$extensions = FileHelper::getExtensionsByMimeType($mime);
if(empty($extensions)) {
if (empty($extensions)) {
return false;
}
$extension = end($extensions);
$data = $this->decode_base64($matches[3]);
if(!$data) {
if (!$data) {
return false;
}
$uploadedFile = new UploadedFile([
'name' => 'someFile.'.$extension,
'name' => 'someFile.' . $extension,
'tempName' => $this->createTmpFile($data),
'size' => strlen($data),
'type' => $mime,
@ -146,11 +145,11 @@ class FileExtension extends RichTextLinkExtension
$fileUpload = new FileUpload(['show_in_stream' => 0]);
$fileUpload->setUploadedFile($uploadedFile);
if(!$fileUpload->save()) {
if (!$fileUpload->save()) {
return false;
}
$fileUpload->updateAttributes(['file_name' => $fileUpload->guid.'.'.$extension]);
$fileUpload->updateAttributes(['file_name' => $fileUpload->guid . '.' . $extension]);
// Since the file is not a real upload, FileUpload won't set the content automatically
$fileUpload->setStoredFileContent($data);
@ -174,7 +173,7 @@ class FileExtension extends RichTextLinkExtension
// Decode the string in strict mode and check the results
$decoded = base64_decode($s, true);
if($decoded === false) {
if ($decoded === false) {
return false;
}

View File

@ -1,9 +1,7 @@
<?php
namespace humhub\modules\content\widgets\richtext\extensions\link;
use yii\base\Model;
use yii\helpers\Url;
@ -43,21 +41,21 @@ class LinkParserBlock extends Model
*/
public $result;
public function getMarkdown() : ?string
public function getMarkdown(): ?string
{
return $this->block[static::BLOCK_KEY_MD] ?? null;
}
public function getUrl() : ?string
public function getUrl(): ?string
{
return $this->block[static::BLOCK_KEY_URL] ?? null;
}
public function toAbsoluteUrl() : void
public function toAbsoluteUrl(): void
{
$url = $this->getUrl();
if($url && $url[0] === '/') {
$url = Url::base(true).$url;
if ($url && $url[0] === '/') {
$url = Url::base(true) . $url;
}
$this->setUrl($url);
@ -68,7 +66,7 @@ class LinkParserBlock extends Model
$this->block[static::BLOCK_KEY_URL] = $url;
}
public function getText() : ?array
public function getText(): ?array
{
return $this->block[static::BLOCK_KEY_TEXT] ?? null;
}
@ -79,7 +77,7 @@ class LinkParserBlock extends Model
$this->setParsedText($text);
}
public function getTitle() : ?string
public function getTitle(): ?string
{
return $this->block[static::BLOCK_KEY_TITLE] ?? null;
}
@ -89,7 +87,7 @@ class LinkParserBlock extends Model
$this->block[static::BLOCK_KEY_TITLE] = $title;
}
public function getFileId() : ?string
public function getFileId(): ?string
{
return $this->block[static::BLOCK_KEY_FILE_ID] ?? null;
}
@ -144,11 +142,11 @@ class LinkParserBlock extends Model
private function textToBlockFormat(string $text)
{
if($this->isImage()) {
if ($this->isImage()) {
return $text;
}
if(!$text) {
if (!$text) {
$text = '';
}

View File

@ -40,7 +40,7 @@ class RichTextLinkExtension extends RichTextContentExtension
* @param RichTextExtensionMatch $match
* @return string
*/
public function initMatch(array $match) : RichTextExtensionMatch
public function initMatch(array $match): RichTextExtensionMatch
{
return new RichTextLinkExtensionMatch(['match' => $match]);
}
@ -48,18 +48,18 @@ class RichTextLinkExtension extends RichTextContentExtension
public static function convertToPlainText($text, $url)
{
if(!static::validateNonExtensionUrl($url)) {
if (!static::validateNonExtensionUrl($url)) {
return $text;
}
return trim($text).'('.$url.')';
return trim($text) . '(' . $url . ')';
}
public static function validateNonExtensionUrl($url)
{
$protocols = ['http', 'https', 'mailto', '#', 'ftp', 'ftps', '/'];
foreach ($protocols as $protocol) {
if(strpos($url, $protocol . ':') === 0) {
if (strpos($url, $protocol . ':') === 0) {
return true;
}
}
@ -76,36 +76,36 @@ class RichTextLinkExtension extends RichTextContentExtension
return static::getLinkExtensionPattern($this->key);
}
public function validateExtensionUrl(string $url) : bool
public function validateExtensionUrl(string $url): bool
{
return strpos($url, $this->key . ':') === 0;
}
public static function buildLink(string $text, string $url, string $title = null) : string
public static function buildLink(string $text, string $url, string $title = null): string
{
if(!$title) {
return '['.$text.']('.$url.')';
if (!$title) {
return '[' . $text . '](' . $url . ')';
}
return '['.$text.']('.$url.' "'.$title.'")';
return '[' . $text . '](' . $url . ' "' . $title . '")';
}
public static function buildExtensionLink(string $text, string $extensionId, string $title = null, string $addition = '') : string
public static function buildExtensionLink(string $text, string $extensionId, string $title = null, string $addition = ''): string
{
if(!empty($addition)) {
$addition = ' '.$addition;
if (!empty($addition)) {
$addition = ' ' . $addition;
}
if(!$title) {
return '['.$text.']('.static::instance()->key.':'.$extensionId.$addition.')';
if (!$title) {
return '[' . $text . '](' . static::instance()->key . ':' . $extensionId . $addition . ')';
}
return '['.$text.']('.static::instance()->key.':'.$extensionId.' "'.$title.'"'.$addition.')';
return '[' . $text . '](' . static::instance()->key . ':' . $extensionId . ' "' . $title . '"' . $addition . ')';
}
public function cutExtensionKeyFromUrl(string $url) : string
public function cutExtensionKeyFromUrl(string $url): string
{
if(!$this->validateExtensionUrl($url)) {
if (!$this->validateExtensionUrl($url)) {
return $url;
}
@ -116,14 +116,14 @@ class RichTextLinkExtension extends RichTextContentExtension
* @param string $extension the extension to parse, if not set all extensions are included
* @return string the regex pattern for a given extension or all extension if no specific extension string is given
*/
public static function getLinkExtensionPattern($extension = '[a-zA-Z-_]+') : string
public static function getLinkExtensionPattern($extension = '[a-zA-Z-_]+'): string
{
if($extension === null) {
$extension = '[a-zA-Z-_]+';
if ($extension === null) {
$extension = '[a-zA-Z-_]+';
}
// [<text>](<extension>:<id> "<title>" <addition> )
return '/(?<!\\\\)!?\[([^\]]*)\]\(('.$extension.'):{1}([^\)\s]*)(?:\s)?(?:"([^"]*)")?(?:\s)?([^\)]*)\)/is';
return '/(?<!\\\\)!?\[([^\]]*)\]\((' . $extension . '):{1}([^\)\s]*)(?:\s)?(?:"([^"]*)")?(?:\s)?([^\)]*)\)/is';
}
public function onBeforeConvert(string $text, string $format, array $options = []): string
@ -136,11 +136,13 @@ class RichTextLinkExtension extends RichTextContentExtension
// TODO: Implement onBeforeConvertLink() method.
}
public function onBeforeOutput(ProsemirrorRichText $richtext, string $output): string {
public function onBeforeOutput(ProsemirrorRichText $richtext, string $output): string
{
return $output;
}
public function onAfterOutput(ProsemirrorRichText $richtext, string $output): string {
public function onAfterOutput(ProsemirrorRichText $richtext, string $output): string
{
return $output;
}
}

View File

@ -1,9 +1,7 @@
<?php
namespace humhub\modules\content\widgets\richtext\extensions\link;
use humhub\modules\content\widgets\richtext\extensions\RichTextExtensionMatch;
/**
@ -30,47 +28,47 @@ class RichTextLinkExtensionMatch extends RichTextExtensionMatch
/**
* @return string
*/
public function getFull() : string
public function getFull(): string
{
return $this->getByIndex(static::INDEX_FULL);
}
public function getText() : string
public function getText(): string
{
return $this->getByIndex(static::INDEX_CONTENT);
}
public function getExtensionKey() : string
public function getExtensionKey(): string
{
return $this->getByIndex(static::INDEX_EXTENSION_KEY);
}
public function getExtensionId() : string
public function getExtensionId(): string
{
return $this->getByIndex(static::INDEX_EXTENSION_ID);
}
public function getExtensionUrl() : string
public function getExtensionUrl(): string
{
return $this->getExtensionKey() . ':' . $this->getExtensionId();
}
public function getTitle() : string
public function getTitle(): string
{
return $this->getByIndex(static::INDEX_TITLE);
}
public function getAddition() : ?string
public function getAddition(): ?string
{
return $this->getByIndex(static::INDEX_ADDITION);
}
public function getByIndex(int $index) : string
public function getByIndex(int $index): string
{
return $this->match[$index] ?? '';
}
public function isImage() : bool
public function isImage(): bool
{
return $this->getFull()[0] === '!';
}

View File

@ -19,18 +19,17 @@ use humhub\components\ActiveRecord;
* This LinkExtension is used to represent mentionings in the richtext as:
*
* [<name>](mention:<guid> "<url>")
*
*/
class MentioningExtension extends RichTextLinkExtension
{
public $key = 'mention';
public function onBeforeOutput(ProsemirrorRichText $richtext, string $output) : string
public function onBeforeOutput(ProsemirrorRichText $richtext, string $output): string
{
return static::replace($output, function(RichTextLinkExtensionMatch $match) use ($richtext) {
return static::replace($output, function (RichTextLinkExtensionMatch $match) use ($richtext) {
$contentContainer = ContentContainer::findOne(['guid' => $match->getExtensionId()]);
if(!$contentContainer || !$contentContainer->getPolymorphicRelation()) {
if (!$contentContainer || !$contentContainer->getPolymorphicRelation()) {
// If no user or space was found we leave out the url in the non edit mode.
return $richtext->edit
? static::buildExtensionLink($match->getText(), $match->getText(), $match->getTitle())
@ -39,13 +38,13 @@ class MentioningExtension extends RichTextLinkExtension
$container = $contentContainer->getPolymorphicRelation();
if($container instanceof User) {
if ($container instanceof User) {
return $container->isActive()
? static::buildMentioning($container)
: static::buildMentioningNotFound($match->getText(), $match->getExtensionId());
}
if($container instanceof Space) {
if ($container instanceof Space) {
return self::buildMentioning($container);
}
@ -56,41 +55,41 @@ class MentioningExtension extends RichTextLinkExtension
/**
* @inheritDoc
*/
public function onBeforeConvertLink(LinkParserBlock $linkBlock) : void
public function onBeforeConvertLink(LinkParserBlock $linkBlock): void
{
$guid = $this->cutExtensionKeyFromUrl($linkBlock->getUrl());
$container = $this->findContainer($guid);
if(!$container || ($container instanceof User && !$container->isActive())) {
$linkBlock->setResult('@'.$linkBlock->getParsedText());
if (!$container || ($container instanceof User && !$container->isActive())) {
$linkBlock->setResult('@' . $linkBlock->getParsedText());
return;
}
$linkBlock->setBlock('@'.$container->getDisplayName(), $container->createUrl(null, [], true));
$linkBlock->setBlock('@' . $container->getDisplayName(), $container->createUrl(null, [], true));
}
private function findContainer($guid) : ?ContentContainerActiveRecord
private function findContainer($guid): ?ContentContainerActiveRecord
{
$result = User::findOne(['guid' => $guid]);
if(!$result) {
if (!$result) {
$result = Space::findOne(['guid' => $guid]);
}
return $result;
}
public static function buildMentioning(ContentContainerActiveRecord $container, $urlScheme = false) : string
public static function buildMentioning(ContentContainerActiveRecord $container, $urlScheme = false): string
{
if($container instanceof User && !$container->isActive()) {
if ($container instanceof User && !$container->isActive()) {
return static::buildMentioningNotFound($container->getDisplayName(), $container->guid);
}
return static::buildLink($container->getDisplayName(), 'mention:'.$container->guid, $container->getUrl($urlScheme));
return static::buildLink($container->getDisplayName(), 'mention:' . $container->guid, $container->getUrl($urlScheme));
}
private static function buildMentioningNotFound($name, $guid) : string
private static function buildMentioningNotFound($name, $guid): string
{
return static::buildExtensionLink($name, $guid);
}
@ -100,14 +99,14 @@ class MentioningExtension extends RichTextLinkExtension
$result[$this->key] = [];
// We currently only support mentionings in content or content addon records
if(!($record instanceof ContentActiveRecord) && !($record instanceof ContentAddonActiveRecord)) {
if (!($record instanceof ContentActiveRecord) && !($record instanceof ContentAddonActiveRecord)) {
return $text;
}
foreach ($this->scanExtension($text) as $match) {
if($match->getExtensionId()) {
if ($match->getExtensionId()) {
$mention = Mentioning::mention($match->getExtensionId(), $record);
if(!empty($mention)) {
if (!empty($mention)) {
$result[$this->key][] = $mention[0];
}
}

View File

@ -13,7 +13,6 @@ use yii\helpers\Html;
* This LinkExtension is used to represent mentionings in the richtext as:
*
* [<name>](mention:<guid> "<url>")
*
*/
class OembedExtension extends RichTextLinkExtension
{
@ -29,24 +28,26 @@ class OembedExtension extends RichTextLinkExtension
*/
private $oembeds = [];
public function onBeforeConvertLink(LinkParserBlock $linkBlock) : void
public function onBeforeConvertLink(LinkParserBlock $linkBlock): void
{
$linkBlock->setUrl($this->cutExtensionKeyFromUrl($linkBlock->getUrl()));
}
public function onBeforeOutput(ProsemirrorRichText $richtext, string $output) : string {
public function onBeforeOutput(ProsemirrorRichText $richtext, string $output): string
{
$this->oembeds = static::parseOembeds($output, static::$maxOembed);
return $output;
}
public function onAfterOutput(ProsemirrorRichText $richtext, string $output) : string {
public function onAfterOutput(ProsemirrorRichText $richtext, string $output): string
{
return $output . $this->buildOembedOutput();
}
/**
* @return string html extension holding the actual oembed dom nodes which will be embedded into the rich text
*/
private function buildOembedOutput() : string
private function buildOembedOutput(): string
{
$result = '';
foreach ($this->oembeds as $url => $oembed) {
@ -56,10 +57,9 @@ class OembedExtension extends RichTextLinkExtension
return Html::tag('div', $result, ['class' => 'richtext-oembed-container', 'style' => 'display:none']);
}
public static function builOembed($url) : string
public static function builOembed($url): string
{
return static::buildLink($url, 'oembed:'.$url);
return static::buildLink($url, 'oembed:' . $url);
}
public static function parseOembeds($text, $max = 100)
@ -67,13 +67,13 @@ class OembedExtension extends RichTextLinkExtension
$result = [];
$oembedCount = 0;
foreach (static::scanLinkExtension($text) as $match) {
if($oembedCount === $max) {
if ($oembedCount === $max) {
break;
}
if(!empty($match->getExtensionId())) {
$oembedPreview = UrlOembed::getOEmbed($match->getExtensionId());
if(!empty($oembedPreview)) {
if (!empty($match->getExtensionId())) {
$oembedPreview = UrlOembed::getOEmbed($match->getExtensionId());
if (!empty($oembedPreview)) {
$oembedCount++;
$result[$match->getExtensionId()] = $oembedPreview;
}
@ -83,9 +83,9 @@ class OembedExtension extends RichTextLinkExtension
return $result;
}
public static function buildOembedNotFound($url) : string
public static function buildOembedNotFound($url): string
{
return '['.$url.']('.$url.')';
return '[' . $url . '](' . $url . ')';
}
/**
@ -102,7 +102,7 @@ class OembedExtension extends RichTextLinkExtension
{
$result[$this->key] = [];
foreach ($this->scanExtension($text) as $match) {
if($match->getExtensionId() && UrlOembed::hasOEmbedSupport($match->getExtensionId())) {
if ($match->getExtensionId() && UrlOembed::hasOEmbedSupport($match->getExtensionId())) {
UrlOembed::preload($match->getExtensionId());
$result[$this->key][] = $match->getExtensionId();
}

View File

@ -1,31 +0,0 @@
<?php
namespace humhub\modules\ui\form\assets;
use humhub\assets\BootstrapMarkdownAsset;
use humhub\components\assets\AssetBundle;
/**
* Class MarkdownFieldAsset
* @package humhub\modules\ui\form\assets
* @deprecated since 1.5 Use `humhub\modules\content\widgets\richtext\RichTextField`
*/
class MarkdownFieldAsset extends AssetBundle
{
public $sourcePath = '@ui/form/resources';
public $css = [
'css/bootstrap-markdown-override.css'
];
public $js = [
'js/markdownEditor.js',
'js/humhub.ui.markdown.js'
];
public $depends = [
BootstrapMarkdownAsset::class
];
}

View File

@ -1,35 +0,0 @@
.md-editor {
border-radius: 3px;
border-width: 2px;
}
.md-editor.active {
outline: 0px none;
box-shadow: none;
}
.md-editor > textarea {
min-height: 100px;
padding: 10px;
font-family: inherit;
color: #555555;
font-size: 14px;
background: #fff !important;
border-top: none;
border-bottom: none;
}
.md-editor textarea {
padding:10px;
}
.md-editor > textarea:focus {
border: 0;
outline: 0;
box-shadow: none;
}
.md-preview {
padding-right:10px;
padding-left:10px;
}

View File

@ -1,141 +0,0 @@
/*
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*
*/
/**
* Module for creating an manipulating modal dialoges.
* Normal layout of a dialog:
*
* <div class="modal">
* <div class="modal-dialog">
* <div class="modal-content">
* <div class="modal-header"></div>
* <div class="modal-body"></div>
* <div class="modal-footer"></div>
* </div>
* </div>
* </div>
*
* @param {type} param1
* @param {type} param2
*/
humhub.module('ui.markdown', function (module, require, $) {
var util = require('util');
var object = util.object;
var Widget = require('ui.widget').Widget;
var client = require('client');
var modal = require('ui.modal');
var MarkdownField = function (node, options) {
Widget.call(this, node, options);
};
object.inherits(MarkdownField, Widget);
MarkdownField.prototype.insert = function(e, chunk) {
var selected = e.getSelection();
var content = e.getContent();
e.replaceSelection(chunk);
var cursor = selected.start;
e.setSelection(cursor, cursor + chunk.length);
};
MarkdownField.prototype.getUploadButtonWidget = function() {
var uploadWidget = Widget.instance('#markdown-file-upload');
uploadWidget.$form = $(this.$.closest('form'));
if (this.options.filesInputName) {
uploadWidget.options.uploadSubmitName = this.options.filesInputName;
} else {
uploadWidget.options.uploadSubmitName = uploadWidget.data('upload-submit-name');
}
return uploadWidget;
};
MarkdownField.prototype.init = function () {
var that = this;
this.$.markdown({
iconlibrary: 'fa',
resize: 'vertical',
additionalButtons: [
[{
name: "groupCustom",
data: [{
name: "cmdLinkWiki",
title: "URL/Link",
icon: {glyph: 'glyphicon glyphicon-link', fa: 'fa fa-link', 'fa-3': 'icon-link'},
callback: function (e) {
var linkModal = modal.get('#markdown-modal-add-link');
$titleInput = linkModal.$.find('.linkTitle');
$urlInput = linkModal.$.find('.linkTarget');
linkModal.show();
$titleInput.val(e.getSelection().text);
if ($titleInput.val() == "") {
$titleInput.focus();
} else {
$urlInput.focus();
}
linkModal.$.find('.addLinkButton').off('click').on('click', function () {
that.insert(e, "[" + $titleInput.val() + "](" + $urlInput.val() + ")");
linkModal.close();
});
linkModal.$.on('hide.bs.modal', function (e) {
$titleInput.val("");
$urlInput.val("");
})
}
},
{
name: "cmdImgWiki",
title: "Image/File",
icon: {glyph: 'glyphicon glyphicon-picture', fa: 'fa fa-picture-o', 'fa-3': 'icon-picture'},
callback: function (e) {
var fileModal = modal.get('#markdown-modal-file-upload');
fileModal.show();
that.getUploadButtonWidget().off('uploadEnd').on('uploadEnd', function(evt, response) {
fileModal.close();
$.each(response.result.files, function(i, file) {
var chunk = (file.mimeType.substring(0, 6) == "image/") ? '!' : '';
chunk += "[" + file.name + "](file-guid-" + file.guid + ")";
that.insert(e, chunk);
e.setSelection(e.end, 0);
});
});
}
},
]
}]
],
reorderButtonGroups: ["groupFont", "groupCustom", "groupMisc", "groupUtil"],
onPreview: function (e) {
var options = {
dataType: 'html',
data : {
markdown: e.getContent()
}
};
client.post(that.options.previewUrl, options).then(function(response) {
that.$.siblings('.md-preview').html(response.html);
});
return "<div><div class='loader'></div></div>";
}
});
};
module.export({
MarkdownField: MarkdownField
});
});

View File

@ -1,167 +0,0 @@
// Newly uploaded file
var newFile = "";
/**
* @deprecated since 1.5
*/
function initMarkdownEditor(elementId) {
if (!$('#addFileModal_' + elementId).length) {
$("body").append($("#markdownEditor_dialogs_" + elementId).html());
}
$("#" + elementId).markdown({
iconlibrary: 'fa',
resize: 'vertical',
additionalButtons: [
[{
name: "groupCustom",
data: [{
name: "cmdLinkWiki",
title: "URL/Link",
icon: {glyph: 'glyphicon glyphicon-link', fa: 'fa fa-link', 'fa-3': 'icon-link'},
callback: function (e) {
addLinkModal = $('#addLinkModal_' + elementId);
linkTitleField = addLinkModal.find('.linkTitle');
linkTargetField = addLinkModal.find('.linkTarget');
addLinkModal.find(".close").off('click');
addLinkModal.modal('show');
linkTitleField.val(e.getSelection().text);
if (linkTitleField.val() == "") {
linkTitleField.focus();
} else {
linkTargetField.focus();
}
addLinkModal.find('.addLinkButton').off('click');
addLinkModal.find('.addLinkButton').on('click', function () {
chunk = "[" + linkTitleField.val() + "](" + linkTargetField.val() + ")";
selected = e.getSelection(), content = e.getContent(),
e.replaceSelection(chunk);
cursor = selected.start;
e.setSelection(cursor, cursor + chunk.length);
addLinkModal.modal('hide')
});
addLinkModal.on('hide.bs.modal', function (ee) {
linkTitleField.val("");
linkTargetField.val("");
})
}
},
{
name: "cmdImgWiki",
title: "Image/File",
icon: {glyph: 'glyphicon glyphicon-picture', fa: 'fa fa-picture-o', 'fa-3': 'icon-picture'},
callback: function (e) {
addFileModal = $('#addFileModal_' + elementId);
addFileModal.modal('show');
addFileModal.find(".uploadForm").show();
addFileModal.find(".uploadProgress").hide();
addFileModal.on('hide.bs.modal', function (ee) {
if (newFile != "") {
var chunk;
if (newFile.mimeType.substring(0, 6) == "image/") {
chunk = "![" + newFile.name + "](file-guid-" + newFile.guid + ") ";
} else {
chunk = "[" + newFile.name + "](file-guid-" + newFile.guid + ") ";
}
insertAtCaret(e.$textarea[0], chunk)
newFile = "";
}
})
}
},
]
}]
],
reorderButtonGroups: ["groupFont", "groupCustom", "groupMisc", "groupUtil"],
onPreview: function (e) {
$.ajax({
type: "POST",
url: markdownPreviewUrl,
data: {
markdown: e.getContent(),
}
}).done(function (previewHtml) {
$('#markdownpreview_' + elementId).html(previewHtml);
});
var previewContent = "<div id='markdownpreview_" + elementId + "'><div class='loader'></div></div>";
return previewContent;
}
});
$('#addFileModal_' + elementId).find(".uploadProgress").hide();
$('#addFileModal_' + elementId).find('.fileUploadButton').fileupload({
dataType: 'json',
done: function (e, data) {
$.each(data.result.files, function (index, file) {
addFileModal = $('#addFileModal_' + elementId);
if (!file.error) {
newFile = file;
hiddenValueField = $('#fileUploaderHiddenGuidField_' + elementId);
hiddenValueField.val(hiddenValueField.val() + "," + file.guid);
addFileModal.modal('hide');
} else {
alert("file upload error");
}
});
},
progressall: function (e, data) {
newFile = "";
addFileModal = $('#addFileModal_' + elementId);
var progress = parseInt(data.loaded / data.total * 100, 10);
addFileModal.find(".uploadForm").hide();
addFileModal.find(".uploadProgress").show();
if (progress == 100) {
addFileModal.find(".uploadProgress").hide();
addFileModal.find(".uploadForm").hide();
}
}
}).prop('disabled', !$.support.fileInput).parent().addClass($.support.fileInput ? undefined : 'disabled');
}
function insertAtCaret(txtarea, text) {
if (!txtarea) {
return;
}
var scrollPos = txtarea.scrollTop;
var strPos = 0;
var br = ((txtarea.selectionStart || txtarea.selectionStart == '0') ? "ff" : (document.selection ? "ie" : false));
if (br == "ie") {
txtarea.focus();
var range = document.selection.createRange();
range.moveStart('character', -txtarea.value.length);
strPos = range.text.length;
} else if (br == "ff") {
strPos = txtarea.selectionStart;
}
var front = (txtarea.value).substring(0, strPos);
var back = (txtarea.value).substring(strPos, txtarea.value.length);
txtarea.value = front + text + back;
strPos = strPos + text.length;
if (br == "ie") {
txtarea.focus();
var ieRange = document.selection.createRange();
ieRange.moveStart('character', -txtarea.value.length);
ieRange.moveStart('character', strPos);
ieRange.moveEnd('character', 0);
ieRange.select();
} else if (br == "ff") {
txtarea.selectionStart = strPos;
txtarea.selectionEnd = strPos;
txtarea.focus();
}
txtarea.scrollTop = scrollPos;
}

View File

@ -1,150 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*
*/
namespace humhub\modules\ui\form\widgets;
use humhub\libs\Html;
use humhub\modules\file\widgets\UploadButton;
use humhub\modules\ui\form\assets\MarkdownFieldAsset;
use yii\helpers\Url;
/**
* Simple Markdown Editor form fields.
*
* @deprecated since 1.5 use `humhub\modules\content\widgets\richtext\RichTextField` instead
* @package humhub\widgets
* @since 1.2.2
*/
class Markdown extends JsInputWidget
{
/**
* @inheritdoc
*/
public $jsWidget = 'ui.markdown.MarkdownField';
/**
* @var int defines the HTML rows attribute of the textarea
*/
public $rows = 3;
/**
* @var string markdown preview url
*/
public $previewUrl;
/**
* HMarkdown parser class used for preview
*
* @var string
*/
public $parserClass = "HMarkdown";
/**
* @var bool show label
*/
public $label = false;
/**
* @var string defines the name of the hidden input name for uploaded files if not set the UploadButton default is used
* @see UploadButton
*/
public $filesInputName;
/**
* Can defined in addition to $fileAttribute to change the form model of the file from $model to $fileModel.
* Note: this is only affects the formName for the file upload.
* @var string
*/
public $fileModel;
/**
* Can be set if $model is defined, to create a loadable fileInput name which is respected in Model::load()
* Note: this is only affects the formName for the file upload.
* @var string
*/
public $fileAttribute;
/**
* @var boolean if set to true the markdown field will be disabled
*/
public $disabled = false;
/**
* @var boolean if set to true the markdown field will set to readonly
*/
public $readonly = false;
/**
* @var string
*/
public $placeholder;
/**
* @inheritdoc
*/
public $fadeIn = 'fast';
/**
* @inheritdoc
*/
public $init = true;
public function init()
{
if (empty($this->previewUrl)) {
$this->previewUrl = Url::toRoute(['/markdown/preview', 'parser' => $this->parserClass]);
}
}
public function run()
{
MarkdownFieldAsset::register($this->view);
if ($this->placeholder === null && $this->hasModel()) {
$this->placeholder = $this->model->getAttributeLabel($this->attribute);
}
if ($this->form != null) {
$textArea = $this->form->field($this->model, $this->attribute)->textarea($this->getOptions())->label($this->label);
} elseif ($this->model != null) {
$textArea = Html::activeTextarea($this->model, $this->attribute, $this->getOptions());
} else {
$textArea = Html::textarea($this->name, $this->value, $this->getOptions());
}
return $textArea;
}
public function getAttributes()
{
return [
'rows' => $this->rows,
'disabled' => $this->disabled,
'readonly' => $this->readonly,
'placeholder' => $this->placeholder,
'class' => 'form-control'
];
}
public function getData()
{
if (empty($this->fileModel)) {
$this->fileModel = $this->model;
}
if ($this->model && $this->fileAttribute) {
$this->filesInputName = $this->fileModel->formName() . '[' . $this->fileAttribute . '][]';
}
return [
'preview-url' => $this->previewUrl,
'files-input-name' => !empty($this->filesInputName) ? $this->filesInputName : null
];
}
}

View File

@ -1,29 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*
*/
namespace humhub\modules\ui\form\widgets;
use humhub\components\Widget;
use humhub\widgets\LayoutAddons;
/**
* Class MarkdownModals provides modals which are added used by the Markdown widget.
* The widget is automatically added to the layout addons.
*
* @see LayoutAddons
* @since 1.3
*/
class MarkdownModals extends Widget
{
public function run()
{
return $this->render('markdownModals');
}
}

View File

@ -1,55 +0,0 @@
<?php
use humhub\modules\file\widgets\UploadButton;
use humhub\widgets\Button;
use humhub\widgets\ModalButton;
use humhub\widgets\ModalDialog;
?>
<div class="modal modal-top" id="markdown-modal-file-upload" tabindex="-1" role="dialog" style="z-index:99999" aria-hidden="true">
<?php ModalDialog::begin(['header' => Yii::t('UiModule.markdownEditor', 'Add image/file')])?>
<div class="modal-body">
<div class="uploadForm">
<?= UploadButton::widget([
'id' => 'markdown-file-upload',
'label' => true,
'tooltip' => false,
'progress' => '#markdown-modal-upload-progress',
'cssButtonClass' => 'btn-default btn-sm',
'dropZone' => '#markdown-modal-file-upload',
'hideInStream' => true
]) ?>
</div>
<br>
<div id="markdown-modal-upload-progress" style="display:none"></div>
</div>
<div class="modal-footer">
<?= ModalButton::cancel(Yii::t('base', 'Close')) ?>
</div>
<?php ModalDialog::end() ?>
</div>
<div class="modal modal-top" id="markdown-modal-add-link" tabindex="-1" role="dialog" style="z-index:99999" aria-hidden="true">
<?php ModalDialog::begin(['header' => Yii::t('UiModule.markdownEditor', 'Add link')])?>
<div class="modal-body">
<div class="form-group">
<label for="addLinkTitle"><?= Yii::t('UiModule.markdownEditor', 'Title'); ?></label>
<input type="text" class="form-control linkTitle"
placeholder="<?= Yii::t('UiModule.markdownEditor', 'Title of your link'); ?>">
</div>
<div class="form-group">
<label for="addLinkTarget"><?= Yii::t('UiModule.markdownEditor', 'Target'); ?></label>
<input type="text" class="form-control linkTarget"
placeholder="<?= Yii::t('UiModule.markdownEditor', 'Enter a url (e.g. http://example.com)'); ?>">
</div>
</div>
<div class="modal-footer">
<?= ModalButton::cancel(Yii::t('base', 'Close')) ?>
<?= Button::primary(Yii::t('UiModule.markdownEditor', 'Add link'))->cssClass('addLinkButton')->loader(false) ?>
</div>
<?php ModalDialog::end() ?>
</div>

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'ምስል/ፋይል ያክሉ',
'Add link' => 'ማስፈንጠሪያ ያክሉ',
'Bold' => 'ጉልህ',
'Close' => 'ዝጋ',
'Code' => 'ኮድ',
'Enter a url (e.g. http://example.com)' => 'url ያስገቡ (ምሳሌ፦ http://example.com)',
'Heading' => 'ራስጌ',
'Image' => 'ምስል',
'Image/File' => 'ምስል/ ፎቶ',
'Insert Hyperlink' => 'ማስተሳሰሪያ ያስገቡ',
'Insert Image Hyperlink' => 'የምስል ማስተሳሰሪያ ያስገቡ',
'Italic' => 'አግድሞሽ',
'List' => 'ዝርዝር',
'Ordered List' => 'ቅድምተከተላዊ ዝርዝር',
'Please wait while uploading...' => 'እባክዎን እስኪጭን ድረስ ይጠብቁ',
'Preview' => 'ቅድመዕይታ',
'Quote' => 'ጥቅስ/አባባል',
'Target' => 'ዒላማ',
'Title' => 'ርዕስ',
'Title of your link' => 'የማስፈንጠሪያዎ ርዕስ',
'URL/Link' => 'URL/ማስፈንጠሪያ',
'Unordered List' => 'ቅደም ተከተል የሌለው ዝርዝር',
'code text here' => 'ሚስጥራዊ ፅሁፍ እዚህ ያስፍሩ',
'emphasized text' => 'አፅእኖት የተሰጠው ፅሁፍ',
'enter image description here' => 'ተደጋጋሚ የምስል ማስፈሪያ እዚህ ያስገቡ',
'enter image title here' => 'ለምስሉ ርዕስ እዚህ ያስገቡ',
'enter link description here' => 'ለማስፈንጠሪያው መግለጫ እዚህ ያስገቡ',
'heading text' => 'የራስጌ ፅሁፍ',
'list text here' => 'ፅሁፍ በዚህ ይዘርዝሩ',
'quote here' => 'በዚህ ይጥቀሱ',
'strong text' => 'ደማቅ ፅሁፍ',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Adhibir imachen/fichero',
'Add link' => 'Adhibir vinclo',
'Bold' => 'Negrita',
'Close' => 'Zarrar',
'Code' => 'Codigo',
'Enter a url (e.g. http://example.com)' => 'Mete una dirección (eix. http://eixemplo.com)',
'Heading' => 'Cabecera',
'Image' => 'Imachen',
'Image/File' => 'Imachen/Fichero',
'Insert Hyperlink' => 'Insertar hipervinclo',
'Insert Image Hyperlink' => 'Insertar hipervinclo d\'imachen',
'Italic' => 'Cursiva',
'List' => 'Lista',
'Ordered List' => 'Lista ordenada',
'Please wait while uploading...' => 'Aguarda mientres se puya...',
'Preview' => 'Preveyer',
'Quote' => 'Comillas',
'Target' => 'Obchectivo',
'Title' => 'Titulek',
'Title of your link' => 'Títol d\'o vinclo',
'URL/Link' => 'URL/Vinclo',
'Unordered List' => 'Lista desordenada',
'code text here' => 'texto d\'o codigo aquí',
'emphasized text' => 'texto destacau',
'enter image description here' => 'mete a descripción d\'a imachen aquí',
'enter image title here' => 'mete o títol d\'a imachen aquí',
'enter link description here' => 'mete a descripción d\'o vinclo aquí',
'heading text' => 'texto de cabecera',
'list text here' => 'texto d\'a lista aquí',
'quote here' => 'cita aquí',
'strong text' => 'texto en negrita',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'إضافة صورة أو ملف',
'Add link' => 'إضافة وصلة',
'Bold' => 'عريض',
'Close' => 'اغلاق',
'Code' => 'كود',
'Enter a url (e.g. http://example.com)' => 'اكتب وصلة مثلاُ http://example.com',
'Heading' => 'عنوان قائمة',
'Image' => 'صورة',
'Image/File' => 'صورة/ملف',
'Insert Hyperlink' => 'أدخل وصلة',
'Insert Image Hyperlink' => 'أدخل وصلة صورة',
'Italic' => 'مائل',
'List' => 'قائمة',
'Ordered List' => '',
'Please wait while uploading...' => 'الرجاء الإنتظار ريثما يتم الرفع',
'Preview' => 'استعراض',
'Quote' => 'اقتباس',
'Target' => 'الهدف',
'Title' => 'العنوان',
'Title of your link' => 'عنوان الوصلة',
'URL/Link' => 'الوصلة',
'Unordered List' => '',
'code text here' => 'ضع كود هنا',
'emphasized text' => 'النص المبالغ فيه',
'enter image description here' => 'الرجاء إدخال وصف الصورة هنا',
'enter image title here' => 'ضع عنوان الصورة هنا',
'enter link description here' => 'ضع وصف الوصلة هنا',
'heading text' => 'نص العنوان',
'list text here' => 'نص القائمة هنا',
'quote here' => 'نص الاقتباس هنا',
'strong text' => 'خط عريض',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Добавете изображение/файл',
'Add link' => 'Добавяне на връзка',
'Bold' => 'Удебелен',
'Close' => 'Затвори',
'Code' => 'Код',
'Enter a url (e.g. http://example.com)' => 'Въведете URL (напр. http://example.com)',
'Heading' => 'Заглавие',
'Image' => 'Изображение',
'Image/File' => 'Изображение /файл',
'Insert Hyperlink' => 'Вмъкни хиперлинк',
'Insert Image Hyperlink' => 'Вкъкни изображение на хиперлинк',
'Italic' => 'Курсив',
'List' => 'Списък',
'Ordered List' => 'Подреден списък',
'Please wait while uploading...' => 'Моля, изчакайте, докато качвате...',
'Preview' => 'Визуализация',
'Quote' => 'Цитирай',
'Target' => 'Цел',
'Title' => 'Звание',
'Title of your link' => 'Име на твоята връзка',
'URL/Link' => 'URL/Връзка',
'Unordered List' => 'Неподреден списък',
'code text here' => 'код на текста тук',
'emphasized text' => 'подчертан текст',
'enter image description here' => 'въведете тук описание на изображението',
'enter image title here' => 'въведете заглавието на изображението тук',
'enter link description here' => 'въведете тук описание на връзката',
'heading text' => 'заглавен текст',
'list text here' => 'списъчен текст тук',
'quote here' => 'цитирай тук',
'strong text' => 'удебелен текст',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => '',
'Add link' => '',
'Bold' => '',
'Close' => 'Serriñ',
'Code' => '',
'Enter a url (e.g. http://example.com)' => '',
'Heading' => '',
'Image' => '',
'Image/File' => '',
'Insert Hyperlink' => '',
'Insert Image Hyperlink' => '',
'Italic' => '',
'List' => '',
'Ordered List' => '',
'Please wait while uploading...' => '',
'Preview' => '',
'Quote' => '',
'Target' => '',
'Title' => '',
'Title of your link' => '',
'URL/Link' => '',
'Unordered List' => '',
'code text here' => '',
'emphasized text' => '',
'enter image description here' => '',
'enter image title here' => '',
'enter link description here' => '',
'heading text' => '',
'list text here' => '',
'quote here' => '',
'strong text' => '',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Afegeix una imatge/arxiu',
'Add link' => 'Afegeix un enllaç',
'Bold' => 'Negreta',
'Close' => 'Tanca',
'Code' => 'Codi',
'Enter a url (e.g. http://example.com)' => 'Entra un enllaç (ex, http://exemple.cat)',
'Heading' => 'Títol',
'Image' => 'Imatge',
'Image/File' => 'Imatge/Arxiu',
'Insert Hyperlink' => 'Inserir Hipervincle',
'Insert Image Hyperlink' => 'Inserir Hipervincle d\'imatge',
'Italic' => 'Cursiva',
'List' => 'Llista',
'Ordered List' => 'Llista ordenada',
'Please wait while uploading...' => 'Si us plau, espereu mentre es carreguen les dades ...',
'Preview' => 'Previsualització',
'Quote' => 'Cita',
'Target' => 'Objectiu',
'Title' => 'Títol',
'Title of your link' => 'Títol del teu enllaç',
'URL/Link' => 'URL/Enllaç',
'Unordered List' => 'Llista desordenada',
'code text here' => 'text del codi aquí',
'emphasized text' => 'text subratllat',
'enter image description here' => 'entra la descripció de l\'imatge aquí',
'enter image title here' => 'entra el títol de l\'imatge aquí',
'enter link description here' => 'entra la descripció de l\'enllaç aquí',
'heading text' => 'text del títol',
'list text here' => 'text de la llista aquí',
'quote here' => 'escriu la cita aquí',
'strong text' => 'text en negreta',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Přidat obrázek/soubor',
'Add link' => 'Přidat odkaz',
'Bold' => 'Tučně',
'Close' => 'Zavřít',
'Code' => 'Kód',
'Enter a url (e.g. http://example.com)' => 'Zadejte URL adresu (např. http://example.com)',
'Heading' => 'Nadpis',
'Image' => 'Obrázek',
'Image/File' => 'Obrázek/soubor',
'Insert Hyperlink' => 'Vložit odkaz',
'Insert Image Hyperlink' => 'Vložit odkaz na obrázek',
'Italic' => 'Kurzíva',
'List' => 'Seznam',
'Ordered List' => 'Objednaný seznam',
'Please wait while uploading...' => 'Prosím počkejte chvíli, nahrávám soubor...',
'Preview' => 'Náhled',
'Quote' => 'Citace',
'Target' => 'Cíl odkazu',
'Title' => 'Název',
'Title of your link' => 'Napište titulek odkazu',
'URL/Link' => 'URL adresa/odkaz',
'Unordered List' => 'Neřízený seznam',
'code text here' => 'zde je místo pro kód',
'emphasized text' => 'text kurzívou',
'enter image description here' => 'zde je místo pro popis obrázku',
'enter image title here' => 'zde je místo pro titulek obrázku',
'enter link description here' => 'zde je místo pro popis odkazu',
'heading text' => 'text nadpisu',
'list text here' => 'odrážka',
'quote here' => 'zde je místo pro citaci',
'strong text' => 'tučný text',
);

View File

@ -1,35 +0,0 @@
<?php
return [
'Add image/file' => '',
'Add link' => '',
'Bold' => '',
'Close' => '',
'Code' => '',
'Enter a url (e.g. http://example.com)' => '',
'Heading' => '',
'Image' => '',
'Image/File' => '',
'Insert Hyperlink' => '',
'Insert Image Hyperlink' => '',
'Italic' => '',
'List' => '',
'Ordered List' => '',
'Please wait while uploading...' => '',
'Preview' => '',
'Quote' => '',
'Target' => '',
'Title' => '',
'Title of your link' => '',
'URL/Link' => '',
'Unordered List' => '',
'code text here' => '',
'emphasized text' => '',
'enter image description here' => '',
'enter image title here' => '',
'enter link description here' => '',
'heading text' => '',
'list text here' => '',
'quote here' => '',
'strong text' => '',
];

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Tilføj billede/fil',
'Add link' => 'Tilføj link',
'Bold' => 'Fed',
'Close' => 'Luk',
'Code' => 'Kode',
'Enter a url (e.g. http://example.com)' => 'Indtast en url (e.g. http://example.com)',
'Heading' => 'Overskrift',
'Image' => 'Billede',
'Image/File' => 'Billede/fil',
'Insert Hyperlink' => 'Indsæt Hyperlink',
'Insert Image Hyperlink' => 'Indsæt Billede Hyperlink',
'Italic' => 'Kursiv',
'List' => 'Liste',
'Ordered List' => '',
'Please wait while uploading...' => 'Vent venligst, uploader...',
'Preview' => 'Forhåndsvisning',
'Quote' => 'Citat',
'Target' => 'Mål',
'Title' => 'Titel',
'Title of your link' => 'Titel til dit link',
'URL/Link' => 'URL/Link',
'Unordered List' => '',
'code text here' => 'kode tekst her',
'emphasized text' => 'understreget tekst',
'enter image description here' => 'skriv billede beskrivelse her',
'enter image title here' => 'skriv billede titel her',
'enter link description here' => 'skriv link beskrivelse her',
'heading text' => 'overskrifts tekst',
'list text here' => 'liste tekst her',
'quote here' => 'citat her',
'strong text' => 'fed tekst',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Bild/Datei einfügen',
'Add link' => 'Link einfügen',
'Bold' => 'Fett',
'Close' => 'Schließen',
'Code' => 'Code',
'Enter a url (e.g. http://example.com)' => 'Trage eine URL ein (z. B. http://example.com)',
'Heading' => 'Überschrift',
'Image' => 'Bild',
'Image/File' => 'Bild/Datei',
'Insert Hyperlink' => 'Hyperlink einfügen',
'Insert Image Hyperlink' => 'Bild-Hyperlink einfügen',
'Italic' => 'Kursiv',
'List' => 'Liste',
'Ordered List' => 'Geordnete Liste',
'Please wait while uploading...' => 'Wird hochgeladen ...',
'Preview' => 'Vorschau',
'Quote' => 'Zitat',
'Target' => 'Ziel',
'Title' => 'Titel',
'Title of your link' => 'Titel des Links',
'URL/Link' => 'URL/Link',
'Unordered List' => 'Ungeordnete Liste',
'code text here' => 'Code hier einfügen',
'emphasized text' => 'unterstrichener Text',
'enter image description here' => 'Gib hier eine Bildbeschreibung ein',
'enter image title here' => 'Gib hier einen Bildtitel ein',
'enter link description here' => 'Gib hier eine Linkbeschreibung ein',
'heading text' => 'Überschrift',
'list text here' => 'Text hier einfügen',
'quote here' => 'hier zitieren',
'strong text' => 'Fetter Text',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => '',
'Add link' => '',
'Bold' => '',
'Close' => 'Κλείσιμο',
'Code' => 'Κώδικας',
'Enter a url (e.g. http://example.com)' => 'Προσθήκη url (π.χ. https://example.com)',
'Heading' => 'Επικεφαλίδα',
'Image' => 'Εικόνα',
'Image/File' => 'Εικόνα/Αρχείο',
'Insert Hyperlink' => 'Εισαγωγή Συνδέσμου',
'Insert Image Hyperlink' => 'Εισαγωγή Συνδέσμου Εικόνας',
'Italic' => '',
'List' => '',
'Ordered List' => 'Ταξινομημένη Λίστα',
'Please wait while uploading...' => '',
'Preview' => '',
'Quote' => '',
'Target' => 'Στόχος',
'Title' => 'Τίτλος',
'Title of your link' => '',
'URL/Link' => '',
'Unordered List' => '',
'code text here' => '',
'emphasized text' => '',
'enter image description here' => '',
'enter image title here' => '',
'enter link description here' => '',
'heading text' => '',
'list text here' => '',
'quote here' => '',
'strong text' => '',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Añadir imagen/archivo',
'Add link' => 'Añadir enlace',
'Bold' => 'Negrita',
'Close' => 'Cerrar',
'Code' => 'Código',
'Enter a url (e.g. http://example.com)' => 'Añade un enlace (ej. http://ejemplo.com)',
'Heading' => 'Título',
'Image' => 'Imagen',
'Image/File' => 'Imagen/Archivo',
'Insert Hyperlink' => 'Insertar hipervínculo',
'Insert Image Hyperlink' => 'Insertar imagen',
'Italic' => 'Cursiva',
'List' => 'Lista',
'Ordered List' => 'Lista ordenada',
'Please wait while uploading...' => 'Por favor, espera mientras se sube...',
'Preview' => 'Previsualizar',
'Quote' => 'Cita',
'Target' => 'Target',
'Title' => 'Título',
'Title of your link' => 'Título de tu enlace',
'URL/Link' => 'URL/Enlace',
'Unordered List' => 'Lista sin orden',
'code text here' => 'Texto con código aquí',
'emphasized text' => 'Texto subrayado',
'enter image description here' => 'Escribe la descripción de la imagen aquí',
'enter image title here' => 'Escribe el título de la imagen aquí',
'enter link description here' => 'Escribe la descripción del enlace aquí',
'heading text' => 'Texto de cabecera',
'list text here' => 'Lista de texto aquí',
'quote here' => 'Citar aquí',
'strong text' => 'Texto en negrita',
);

View File

@ -1,35 +0,0 @@
<?php
return [
'Add image/file' => '',
'Add link' => '',
'Bold' => '',
'Close' => '',
'Code' => '',
'Enter a url (e.g. http://example.com)' => '',
'Heading' => '',
'Image' => '',
'Image/File' => '',
'Insert Hyperlink' => '',
'Insert Image Hyperlink' => '',
'Italic' => '',
'List' => '',
'Ordered List' => '',
'Please wait while uploading...' => '',
'Preview' => '',
'Quote' => '',
'Target' => '',
'Title' => '',
'Title of your link' => '',
'URL/Link' => '',
'Unordered List' => '',
'code text here' => '',
'emphasized text' => '',
'enter image description here' => '',
'enter image title here' => '',
'enter link description here' => '',
'heading text' => '',
'list text here' => '',
'quote here' => '',
'strong text' => '',
];

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'افزودن عکس/پرونده',
'Add link' => 'افزودن پیوند',
'Bold' => 'پررنگ',
'Close' => 'بستن',
'Code' => 'کد',
'Enter a url (e.g. http://example.com)' => 'یک آدرس وارد کنید (مثلا: http://example.com)',
'Heading' => 'سرنویس',
'Image' => 'عکس',
'Image/File' => 'عکس/افزودن',
'Insert Hyperlink' => 'درج ابرپیوند',
'Insert Image Hyperlink' => 'درج ابرپیوند عکس',
'Italic' => 'ایتالیک',
'List' => 'فهرست',
'Ordered List' => 'فهرست شماره‌ای',
'Please wait while uploading...' => 'لطفا تا بارگذاری صبر کنید...',
'Preview' => 'پیش‌نمایش',
'Quote' => 'نقل‌قول',
'Target' => 'مقصد',
'Title' => 'عنوان',
'Title of your link' => 'عنوان پیوند شما',
'URL/Link' => 'URL/پیوند',
'Unordered List' => 'فهرست بدون شماره',
'code text here' => 'متن را اینجا کد کنید',
'emphasized text' => 'متن تاکیدشده',
'enter image description here' => 'توضیحات عکس را اینجا وارد کنید',
'enter image title here' => 'عنوان عکس را اینجا وارد کنید',
'enter link description here' => 'توضیحات پیوند را اینجا وارد کنید',
'heading text' => 'متن سرنویس',
'list text here' => 'متن را اینجا لیست کنید',
'quote here' => 'اینجا بیان کنید',
'strong text' => 'متن پررنگ',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Lisää kuva/tiedosto',
'Add link' => 'Lisää linkki',
'Bold' => 'Lihavointi',
'Close' => 'Sulje',
'Code' => 'Koodi',
'Enter a url (e.g. http://example.com)' => 'Syötä url (esim. https://esimerkki.fi)',
'Heading' => 'Otsikko',
'Image' => 'Kuva',
'Image/File' => 'Kuva/Tiedosto',
'Insert Hyperlink' => 'Syötä Hyperlinkki',
'Insert Image Hyperlink' => 'Syötä Kuvan Hyperlinkki',
'Italic' => 'Kursivointi',
'List' => 'Lista',
'Ordered List' => 'Tehtävä Lista',
'Please wait while uploading...' => 'Odata päivitetään',
'Preview' => 'Esikatselu',
'Quote' => 'Lainaa',
'Target' => 'Kohde',
'Title' => 'Otsikko',
'Title of your link' => 'Kirjoita linkkisi',
'URL/Link' => 'URL/Linkki',
'Unordered List' => 'Järjestämätön lista',
'code text here' => 'koodi tähän',
'emphasized text' => 'Korostettu teksti',
'enter image description here' => 'kirjoita kuvaus täähän',
'enter image title here' => 'kirjoita otsikko tähän',
'enter link description here' => 'syötä linkki tähän',
'heading text' => 'otsikon teksti',
'list text here' => 'syötä listan teksti tähän',
'quote here' => 'syötä korostettu teksti tähän',
'strong text' => 'vahva teksti',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Ajouter une image/fichier',
'Add link' => 'Ajouter un lien',
'Bold' => 'Gras',
'Close' => 'Fermer',
'Code' => 'Code',
'Enter a url (e.g. http://example.com)' => 'Entrer une URL (p.ex. http://exemple.com)',
'Heading' => 'Entête',
'Image' => 'Image',
'Image/File' => 'Image/fichier',
'Insert Hyperlink' => 'Insérer un lien',
'Insert Image Hyperlink' => 'Insérer un lien vers une image',
'Italic' => 'Italique',
'List' => 'Liste',
'Ordered List' => 'Liste ordonnée',
'Please wait while uploading...' => 'Veuillez patienter pendant le transfert...',
'Preview' => 'Prévisualiser',
'Quote' => 'Citation',
'Target' => 'Destination',
'Title' => 'Titre',
'Title of your link' => 'Titre de votre lien',
'URL/Link' => 'URL/Lien',
'Unordered List' => 'Liste désordonnée',
'code text here' => 'texte code ici',
'emphasized text' => 'texte mis en valeur',
'enter image description here' => 'saisir la description de l\'image ici',
'enter image title here' => 'saisir le titre de l\'image ici',
'enter link description here' => 'saisir la description du lien ici',
'heading text' => 'texte d\'entête',
'list text here' => 'texte de la liste ici',
'quote here' => 'citation ici',
'strong text' => 'texte gras',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => '',
'Add link' => '',
'Bold' => '',
'Close' => 'סגור',
'Code' => '',
'Enter a url (e.g. http://example.com)' => '',
'Heading' => '',
'Image' => '',
'Image/File' => '',
'Insert Hyperlink' => '',
'Insert Image Hyperlink' => '',
'Italic' => '',
'List' => '',
'Ordered List' => '',
'Please wait while uploading...' => '',
'Preview' => '',
'Quote' => '',
'Target' => '',
'Title' => 'כותרת',
'Title of your link' => '',
'URL/Link' => '',
'Unordered List' => '',
'code text here' => '',
'emphasized text' => '',
'enter image description here' => '',
'enter image title here' => '',
'enter link description here' => '',
'heading text' => '',
'list text here' => '',
'quote here' => '',
'strong text' => '',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Dodaj sliku / datoteku',
'Add link' => 'Dodaj poveznicu',
'Bold' => 'Bold',
'Close' => 'Zatvori',
'Code' => 'Kod',
'Enter a url (e.g. http://example.com)' => 'Unesite URL (e.g. http://example.com)',
'Heading' => 'Naslov',
'Image' => 'Slika',
'Image/File' => 'Slika/Datoteka',
'Insert Hyperlink' => 'Unesi hyperlink',
'Insert Image Hyperlink' => 'Unesi hyperlink slike',
'Italic' => 'Italic',
'List' => 'Lista',
'Ordered List' => 'Uređeni popis',
'Please wait while uploading...' => 'Pričekajte dok se učitava...',
'Preview' => 'Pregled',
'Quote' => 'Citat',
'Target' => 'Cilj',
'Title' => 'Naziv',
'Title of your link' => 'Naziv vašeg linka',
'URL/Link' => 'URL/Link',
'Unordered List' => 'Neuređeni popis',
'code text here' => 'tekst koda ovdje',
'emphasized text' => 'naglasi tekst',
'enter image description here' => 'unesite opis slike',
'enter image title here' => 'unesite naziv slike',
'enter link description here' => 'unesite opis linka',
'heading text' => 'tekst naslova',
'list text here' => 'unesite popis tekstova',
'quote here' => 'ovdje navedite',
'strong text' => 'jaki tekst',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Ajoute foto/dosye',
'Add link' => 'Ajoute lyen',
'Bold' => 'Fonse',
'Close' => 'Fèmen',
'Code' => 'Kòd',
'Enter a url (e.g. http://example.com)' => 'Mete yon url (e.g http://example.com)',
'Heading' => 'Tit',
'Image' => 'Imaj',
'Image/File' => 'Imaj/Dosye',
'Insert Hyperlink' => 'Antre Ipèrtèkst la',
'Insert Image Hyperlink' => 'Antre Imaj Ipèrtèkst la',
'Italic' => 'Italik',
'List' => 'Lis',
'Ordered List' => '',
'Please wait while uploading...' => 'Tanpri, ret tan\'n pandan l\'ap upload...',
'Preview' => 'Apèsi',
'Quote' => 'Sitasyon',
'Target' => 'Tagèt',
'Title' => 'Tit',
'Title of your link' => 'Tit Link ou a',
'URL/Link' => 'URL/Link',
'Unordered List' => '',
'code text here' => 'Mete Kòd tèks ou a la',
'emphasized text' => 'Mete aksan sou tèks la',
'enter image description here' => 'Mete deskripsyon imaj la',
'enter image title here' => 'Mete tit imaj la',
'enter link description here' => 'Mete deskripsyon link lan la',
'heading text' => 'Tit tèks la',
'list text here' => 'Mete lis tèks ou a la',
'quote here' => 'Mete sitasyon an la',
'strong text' => 'Tèks gra',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Kép/fájl hozzáadása',
'Add link' => 'Link hozzáadása',
'Bold' => 'Félkövér',
'Close' => 'Bezár',
'Code' => 'Kód',
'Enter a url (e.g. http://example.com)' => 'Írj be egy URL-címet (pl.: http://pelda.hu)',
'Heading' => 'Fejléc',
'Image' => 'Kép',
'Image/File' => 'Kép/fájl',
'Insert Hyperlink' => 'Link beszúrása',
'Insert Image Hyperlink' => 'Kép link beszúrása',
'Italic' => 'Dőlt',
'List' => 'Lista',
'Ordered List' => 'Számozott lista',
'Please wait while uploading...' => 'Várj, feltöltés folyamatban...',
'Preview' => 'Előnézet',
'Quote' => 'Idézet',
'Target' => 'Cél',
'Title' => 'Cím',
'Title of your link' => 'Link leírása',
'URL/Link' => 'URL/Link',
'Unordered List' => 'Felsorolás',
'code text here' => 'kód szövege',
'emphasized text' => 'dőlt betűs szöveg',
'enter image description here' => 'kép leírásának megadása',
'enter image title here' => 'kép címének megadása',
'enter link description here' => 'link leírásának megadása',
'heading text' => 'címsor',
'list text here' => 'felsorolás szövege',
'quote here' => 'idézet szövege',
'strong text' => 'félkövér szöveg',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Tambah image/file',
'Add link' => 'Tambah link',
'Bold' => '',
'Close' => 'Tutup',
'Code' => '',
'Enter a url (e.g. http://example.com)' => 'Masukkan sebuah url (misalnya http://contoh.com)',
'Heading' => '',
'Image' => '',
'Image/File' => '',
'Insert Hyperlink' => 'Masukkan Hyperlink',
'Insert Image Hyperlink' => 'Masukkan Image Hyperlink',
'Italic' => '',
'List' => '',
'Ordered List' => '',
'Please wait while uploading...' => 'Harap tunggu selama proses upload...',
'Preview' => '',
'Quote' => '',
'Target' => '',
'Title' => 'Judul',
'Title of your link' => 'Judul link anda',
'URL/Link' => '',
'Unordered List' => '',
'code text here' => 'code text disini',
'emphasized text' => '',
'enter image description here' => 'masukkan deskripsi image disini',
'enter image title here' => 'masukkan judul image disini',
'enter link description here' => 'masukkan deskripsi link disini',
'heading text' => '',
'list text here' => 'text list disini',
'quote here' => 'quote disini',
'strong text' => '',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Aggiungi immagine/file',
'Add link' => 'Aggiungi link',
'Bold' => 'Grassetto',
'Close' => 'Chiudi',
'Code' => 'Codice',
'Enter a url (e.g. http://example.com)' => 'Inserisci un URL (es. http://example.com)',
'Heading' => 'Intestazione',
'Image' => 'Immagine',
'Image/File' => 'Immagine/File',
'Insert Hyperlink' => 'Inserisci un link',
'Insert Image Hyperlink' => 'Inserisci un link di un\'immagie',
'Italic' => 'Corsivo',
'List' => 'Lista',
'Ordered List' => 'Lista ordinata',
'Please wait while uploading...' => 'Attendi il caricamento...',
'Preview' => 'Anteprima',
'Quote' => 'Quota',
'Target' => 'Destinazione',
'Title' => 'Titolo',
'Title of your link' => 'Titolo del tuo link',
'URL/Link' => 'URL/Link',
'Unordered List' => 'Lista non ordinata',
'code text here' => 'testo di codice',
'emphasized text' => 'testo corsivo',
'enter image description here' => 'scrivi la descrizione dell\'immagine qui',
'enter image title here' => 'scrivi il titolo dell\'immagine qui',
'enter link description here' => 'scrivi la descrizione del link qui',
'heading text' => 'testo d\'intestazione',
'list text here' => 'elemento lista',
'quote here' => 'testo quotato',
'strong text' => 'testo in grassetto',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => '画像/ファイルを追加する',
'Add link' => 'リンクを追加',
'Bold' => '太字',
'Close' => '閉じる',
'Code' => 'コード',
'Enter a url (e.g. http://example.com)' => 'URLを入力してくださいhttp://example.com',
'Heading' => '見出し',
'Image' => '画像',
'Image/File' => '画像/ファイル',
'Insert Hyperlink' => 'ハイパーリンクの挿入',
'Insert Image Hyperlink' => 'イメージハイパーリンクを挿入',
'Italic' => 'イタリック',
'List' => 'リスト',
'Ordered List' => '番号付きリスト',
'Please wait while uploading...' => 'アップロード中はお待ちください...',
'Preview' => 'プレビュー',
'Quote' => '引用',
'Target' => 'ターゲット',
'Title' => 'タイトル',
'Title of your link' => 'リンクのタイトル',
'URL/Link' => 'URL /リンク',
'Unordered List' => '順不同リスト',
'code text here' => 'コードテキストはこちら',
'emphasized text' => '強調されたテキスト',
'enter image description here' => 'ここに画像の説明を入力',
'enter image title here' => 'ここに画像タイトルを入力してください',
'enter link description here' => 'ここにリンクの説明を入力してください',
'heading text' => '見出しテキスト',
'list text here' => 'ここにテキストをリストする',
'quote here' => 'ここに引用',
'strong text' => '強いテキスト',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => '이미지/파일 추가',
'Add link' => '링크 추가',
'Bold' => '굵게',
'Close' => '닫기',
'Code' => '코드',
'Enter a url (e.g. http://example.com)' => '링크를 입력해주세요 (예시: http://example.com/)',
'Heading' => '제목',
'Image' => '이미지',
'Image/File' => '이미지/파일',
'Insert Hyperlink' => '하이퍼링크 삽입',
'Insert Image Hyperlink' => '이미지 링크 삽입',
'Italic' => '이탤릭',
'List' => '리스트',
'Ordered List' => '',
'Please wait while uploading...' => '업로드 중입니다. 기다려주세요...',
'Preview' => '미리보기',
'Quote' => '인용하기',
'Target' => '타겟',
'Title' => '제목',
'Title of your link' => '링크 제목',
'URL/Link' => '링크',
'Unordered List' => '',
'code text here' => '코드를 적어주세요',
'emphasized text' => '강조 텍스트',
'enter image description here' => '이미지 설명을 여기에 적어주세요',
'enter image title here' => '이미지 제목을 여기에 적어주세요',
'enter link description here' => '링크 설명을 여기에 적어주세요',
'heading text' => '제목 텍스트',
'list text here' => '리스트 내용을 여기에 적어주세요',
'quote here' => '인용 내용을 여기에 적어주세요',
'strong text' => '볼드 문자',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Pridėti nuotrauką / failą',
'Add link' => 'įterpti nuorodą',
'Bold' => 'Paryškinti',
'Close' => 'Uždaryti',
'Code' => 'Kodas',
'Enter a url (e.g. http://example.com)' => 'Pridėti internetinio puslapio adresą (pvz., http://example.com)',
'Heading' => 'Pavadinimas',
'Image' => 'Nuotrauka',
'Image/File' => 'Nuotrauka / failas',
'Insert Hyperlink' => 'Pridėti nuorodą',
'Insert Image Hyperlink' => 'Pridėkite nuorodos nuotrauką',
'Italic' => 'Kursyvas',
'List' => 'Sarašas',
'Ordered List' => '',
'Please wait while uploading...' => 'Palaukite, kol keliami duomenys',
'Preview' => 'Peržiūra',
'Quote' => 'Citata',
'Target' => 'Objektas',
'Title' => 'Pavadinimas',
'Title of your link' => 'Jūsu nuorodos pavadinimas',
'URL/Link' => 'URL/nuoroda',
'Unordered List' => '',
'code text here' => 'Koduoti teksta',
'emphasized text' => 'Pabrėžti tekstą',
'enter image description here' => 'Įrašyti paveikslėlio apibūdinimą čia',
'enter image title here' => 'Įrašyti paveikslėlio pavadinimą čia',
'enter link description here' => 'Įrašyti nuorodos apibūdinimą čia',
'heading text' => 'Pavadinimas',
'list text here' => 'Įrašyti tekstą čia',
'quote here' => 'Cituoti čia',
'strong text' => 'Paryškintas tekstas',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Pievienot attēlu/failu',
'Add link' => 'Pievienot saiti',
'Bold' => 'Treknraksts',
'Close' => 'Aizvērt',
'Code' => 'Kods',
'Enter a url (e.g. http://example.com)' => 'Ievadi url (piem. http://example.com)',
'Heading' => 'Virsraksts',
'Image' => 'Attēls',
'Image/File' => 'Attēls/Fails',
'Insert Hyperlink' => 'Ievietot hipersaiti',
'Insert Image Hyperlink' => 'Ievietot attēla hipersaiti',
'Italic' => 'Slīpraksts',
'List' => 'Saraksts',
'Ordered List' => 'Kārtots saraksts',
'Please wait while uploading...' => 'Uzgaidi, kamēr augšupielādējas...',
'Preview' => 'Priekšskatīt',
'Quote' => 'Citāts',
'Target' => 'Mērķis',
'Title' => 'Nosaukums',
'Title of your link' => 'Saites nosaukums',
'URL/Link' => 'URL/Saite',
'Unordered List' => 'Nekārtots saraksts',
'code text here' => 'koda teksts šeit',
'emphasized text' => 'uzsvērts teksts',
'enter image description here' => 'ievadi šeit attēla aprakstu',
'enter image title here' => 'ievadi šeit attēla nosaukumu',
'enter link description here' => 'ievadi šeit saites aprakstu',
'heading text' => 'virsraksta teksts',
'list text here' => 'saraksta teksts šeit',
'quote here' => 'citāts šeit',
'strong text' => 'trenknraksta teksts šeit',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Legg til bilde/fil',
'Add link' => 'Legg til link',
'Bold' => 'Fet',
'Close' => 'Lukk',
'Code' => 'Kode',
'Enter a url (e.g. http://example.com)' => 'Legg til en link (f.eks. http://example.com)',
'Heading' => 'Tittel',
'Image' => 'Bilde',
'Image/File' => 'Bilde/Fil',
'Insert Hyperlink' => 'Sett inn link',
'Insert Image Hyperlink' => 'Sett inn bildelink',
'Italic' => 'Kursiv',
'List' => 'Liste',
'Ordered List' => 'nummerert liste',
'Please wait while uploading...' => 'Vennligst vent mens filen lastes opp...',
'Preview' => 'Forhåndsvisning',
'Quote' => 'Sitat',
'Target' => 'Mål',
'Title' => 'Tittel',
'Title of your link' => 'Link tittel',
'URL/Link' => 'URL/Link',
'Unordered List' => 'punktliste',
'code text here' => 'Kodetekst her',
'emphasized text' => 'uthevet tekst',
'enter image description here' => 'legg til en bildebeskrivelse her',
'enter image title here' => 'legg til bildetittel her',
'enter link description here' => 'legg til linkbeskrivelse her',
'heading text' => 'overskriftstekst',
'list text here' => 'listetekst her',
'quote here' => 'sitat her',
'strong text' => 'uthevet tekst',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Voeg afbeelding/bestand toe',
'Add link' => 'Voeg link toe',
'Bold' => 'Vet',
'Close' => 'Sluiten',
'Code' => 'Code',
'Enter a url (e.g. http://example.com)' => 'Voer een URL in (bijvoobeeld http://example.com)',
'Heading' => 'Kop',
'Image' => 'Afbeelding',
'Image/File' => 'Afbeelding/Bestand',
'Insert Hyperlink' => 'Link invoegen',
'Insert Image Hyperlink' => 'Afbeelding link invoegen',
'Italic' => 'Cursief',
'List' => 'Lijst',
'Ordered List' => 'Genummerde lijst',
'Please wait while uploading...' => 'Even geduld aub...',
'Preview' => 'Voorbeeld',
'Quote' => 'Quote',
'Target' => 'Doel',
'Title' => 'Titel',
'Title of your link' => 'Titel van de link',
'URL/Link' => 'URL/Link',
'Unordered List' => 'Opsommingslijst',
'code text here' => 'Code tekst hier',
'emphasized text' => 'benadrukte tekst',
'enter image description here' => 'Afbeelding omschrijving',
'enter image title here' => 'Afbeelding titel',
'enter link description here' => 'Link omschrijving',
'heading text' => 'Koptekst',
'list text here' => 'Lijsttekst',
'quote here' => 'quote hier plaatsen',
'strong text' => 'belangrijke tekst',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => '',
'Add link' => '',
'Bold' => '',
'Close' => '',
'Code' => '',
'Enter a url (e.g. http://example.com)' => '',
'Heading' => '',
'Image' => '',
'Image/File' => '',
'Insert Hyperlink' => '',
'Insert Image Hyperlink' => '',
'Italic' => '',
'List' => '',
'Ordered List' => '',
'Please wait while uploading...' => '',
'Preview' => '',
'Quote' => '',
'Target' => '',
'Title' => 'Tittel',
'Title of your link' => '',
'URL/Link' => '',
'Unordered List' => '',
'code text here' => '',
'emphasized text' => '',
'enter image description here' => '',
'enter image title here' => '',
'enter link description here' => '',
'heading text' => '',
'list text here' => '',
'quote here' => '',
'strong text' => '',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Dodaj obrazek/plik',
'Add link' => 'Dodaj link',
'Bold' => 'Pogrubienie',
'Close' => 'Zamknij',
'Code' => 'Kod',
'Enter a url (e.g. http://example.com)' => 'Wpisz url (n.p. http://example.com)',
'Heading' => 'Nagłówek',
'Image' => 'Obrazek',
'Image/File' => 'Obrazek/Plik',
'Insert Hyperlink' => 'Wstaw Hiperłącze',
'Insert Image Hyperlink' => 'Wstaw link obrazka',
'Italic' => 'Kursywa',
'List' => 'Lista',
'Ordered List' => 'Lista uporządkowana',
'Please wait while uploading...' => 'Proszę czekać trwa przesyłanie pliku...',
'Preview' => 'Podgląd',
'Quote' => 'Cytat',
'Target' => 'Cel',
'Title' => 'Tytuł',
'Title of your link' => 'Tytuł twojego odnośnika',
'URL/Link' => 'URL/Odnośnik',
'Unordered List' => 'Lista nieuporządkowana',
'code text here' => 'tutaj wpisz kod',
'emphasized text' => 'wyróżniony tekst',
'enter image description here' => 'wpisz opis obrazka',
'enter image title here' => 'wpisz tytuł obrazka',
'enter link description here' => 'wpisz opis odnośnika',
'heading text' => 'tekst nagłówka',
'list text here' => 'tutaj wpisz listę',
'quote here' => 'tutaj wpisz cytat',
'strong text' => 'pogrubiony tekst',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Adicionar imagem / arquivo',
'Add link' => 'Adicionar Link',
'Bold' => 'Negrito',
'Close' => 'Fechar',
'Code' => 'Código',
'Enter a url (e.g. http://example.com)' => 'Digite uma URL (ex.: http://exemplo.com)',
'Heading' => 'Título',
'Image' => 'Imagem',
'Image/File' => 'Imagem/Arquivo',
'Insert Hyperlink' => 'Inserir link',
'Insert Image Hyperlink' => 'Inserir imagem com link',
'Italic' => 'Itálico',
'List' => 'Lista',
'Ordered List' => 'Lista ordenada',
'Please wait while uploading...' => 'Por favor aguarde enquanto o arquivo é carregado',
'Preview' => 'Pré-visualizar',
'Quote' => 'Citar',
'Target' => 'Alvo',
'Title' => 'Título',
'Title of your link' => 'Título do seu link',
'URL/Link' => 'URL/Link',
'Unordered List' => 'Lista não ordenada',
'code text here' => 'código aqui',
'emphasized text' => 'texto enfatizado',
'enter image description here' => 'insira a descrição da imagem aqui',
'enter image title here' => 'insira o título da imagem aqui',
'enter link description here' => 'insira a descrição do link aqui',
'heading text' => 'texto do título',
'list text here' => 'texto da lista aqui',
'quote here' => 'citação aqui',
'strong text' => 'texto em negrito',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Adicionar imagem/ficheiro',
'Add link' => 'Adicionar link',
'Bold' => 'Negrito',
'Close' => 'Fechar',
'Code' => 'Código',
'Enter a url (e.g. http://example.com)' => 'Introduz um url (ex. http://xkcd.com)',
'Heading' => 'Cabeçalho',
'Image' => 'Imagem',
'Image/File' => 'Imagem/Ficheiro',
'Insert Hyperlink' => 'Insere uma hiperligação',
'Insert Image Hyperlink' => 'Insere uma hiperligação de imagem',
'Italic' => 'Itálico',
'List' => 'Lista',
'Ordered List' => 'Lista Ordenada',
'Please wait while uploading...' => 'Aguarda um pouco enquanto é feito o carregamento...',
'Preview' => 'Pré-visualizar',
'Quote' => 'Citar',
'Target' => 'Alvo',
'Title' => 'Título',
'Title of your link' => 'Título do teu link',
'URL/Link' => 'URL/Link',
'Unordered List' => 'Lista Desordenada',
'code text here' => 'texto do código aqui',
'emphasized text' => 'texto enfatizado',
'enter image description here' => 'insere a descrição da imagem aqui',
'enter image title here' => 'insere o título da imagem aqui',
'enter link description here' => 'insere a descrição do link aqui',
'heading text' => 'texto do cabeçalho',
'list text here' => 'lista de texto aqui',
'quote here' => 'citar aqui',
'strong text' => 'texto negrito',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Adaugă imagine/fișier',
'Add link' => 'Adaugă legătură',
'Bold' => 'Îngroșat',
'Close' => 'Închide',
'Code' => 'Cod',
'Enter a url (e.g. http://example.com)' => 'Introdu o legătură (ex: http://exemplu.ro)',
'Heading' => 'Antet',
'Image' => 'Imagine',
'Image/File' => 'Imagine/Fișier',
'Insert Hyperlink' => 'Inserează Hiperlegătură',
'Insert Image Hyperlink' => 'Inserează Hiperlegătura Imaginii',
'Italic' => 'Înclinat',
'List' => 'Listă',
'Ordered List' => 'Lista ordonată',
'Please wait while uploading...' => 'Te rugăm să aștepți până se încarcă...',
'Preview' => 'Previzualizare',
'Quote' => 'Citat',
'Target' => 'Țintă',
'Title' => 'Titlul',
'Title of your link' => 'Titlul legăturii tale',
'URL/Link' => 'URL/Legătură',
'Unordered List' => 'Listă neordonata',
'code text here' => 'textul codului aici',
'emphasized text' => 'text subliniat',
'enter image description here' => 'introdu descrierea imaginii aici',
'enter image title here' => 'introdu titlul imaginii aici',
'enter link description here' => 'introdu descrierea legăturii aici',
'heading text' => 'textul antetului',
'list text here' => 'textul listei aici',
'quote here' => 'citatul aici',
'strong text' => 'text îngroșat',
);

View File

@ -1,38 +0,0 @@
<?php
/**
* Translation: Paul (https://paul.bid) paulbid@protonmail.com
*
*/
return array (
'Add image/file' => 'Добавить изображение/файл',
'Add link' => 'Добавить ссылку',
'Bold' => 'Полужирный',
'Close' => 'Закрыть',
'Code' => 'Блок кода',
'Enter a url (e.g. http://example.com)' => 'Введите ссылку (например https://example.com)',
'Heading' => 'Заголовок',
'Image' => 'Изображение',
'Image/File' => 'Изображение/Файл',
'Insert Hyperlink' => 'Вставить гиперссылку',
'Insert Image Hyperlink' => 'Вставить гиперссылку на изображение',
'Italic' => 'Курсив',
'List' => 'Список',
'Ordered List' => 'Упорядоченный список',
'Please wait while uploading...' => 'Пожалуйста, подождите пока загрузится...',
'Preview' => 'Предпросмотр',
'Quote' => 'Цитата',
'Target' => 'Цель',
'Title' => 'Заголовок',
'Title of your link' => 'Название Вашей ссылки',
'URL/Link' => 'Адрес/Ссылка',
'Unordered List' => 'Маркированный список',
'code text here' => 'вставьте код здесь',
'emphasized text' => 'выделенный текст',
'enter image description here' => 'введите описание изображения здесь',
'enter image title here' => 'введите название изображения здесь',
'enter link description here' => 'введите описание ссылки здесь',
'heading text' => 'заголовок текста',
'list text here' => 'введите список здесь',
'quote here' => 'процитировать',
'strong text' => 'выделенный текст',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => '사진/파일 추가',
'Add link' => '링크 추가',
'Bold' => '굵게',
'Close' => '닫기',
'Code' => '소스코드',
'Enter a url (e.g. http://example.com)' => '링크를 입력하세요 (예: http://google.com)',
'Heading' => '제목',
'Image' => '이미지',
'Image/File' => '이미지/파일',
'Insert Hyperlink' => '링크 삽입',
'Insert Image Hyperlink' => '이미지에 링크 삽입',
'Italic' => '이탤릭',
'List' => '리스트',
'Ordered List' => '',
'Please wait while uploading...' => '업로드 중입니다. 잠시만 기다려주세요...',
'Preview' => '미리보기',
'Quote' => '인용',
'Target' => '타겟',
'Title' => '제목',
'Title of your link' => '링크 제목',
'URL/Link' => 'URL/링크',
'Unordered List' => '',
'code text here' => '소스코드를 입력해주세요',
'emphasized text' => '텍스트 강조',
'enter image description here' => '이미지 설명을 입력해주세요',
'enter image title here' => '이미지 제목을 입력해주세요',
'enter link description here' => '링크 설명을 입력해주세요',
'heading text' => '제목 텍스트',
'list text here' => '여기에 리스트 내용을 입력해주세요',
'quote here' => '여기에 인용할 내용을 입력해주세요',
'strong text' => '굵은 텍스트',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => '',
'Add link' => '',
'Bold' => '',
'Close' => '',
'Code' => '',
'Enter a url (e.g. http://example.com)' => '',
'Heading' => '',
'Image' => '',
'Image/File' => '',
'Insert Hyperlink' => '',
'Insert Image Hyperlink' => '',
'Italic' => '',
'List' => '',
'Ordered List' => '',
'Please wait while uploading...' => '',
'Preview' => '',
'Quote' => '',
'Target' => '',
'Title' => 'Naslov',
'Title of your link' => '',
'URL/Link' => '',
'Unordered List' => '',
'code text here' => '',
'emphasized text' => '',
'enter image description here' => '',
'enter image title here' => '',
'enter link description here' => '',
'heading text' => '',
'list text here' => '',
'quote here' => '',
'strong text' => '',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => '',
'Add link' => '',
'Bold' => '',
'Close' => '',
'Code' => '',
'Enter a url (e.g. http://example.com)' => '',
'Heading' => '',
'Image' => '',
'Image/File' => '',
'Insert Hyperlink' => '',
'Insert Image Hyperlink' => '',
'Italic' => '',
'List' => '',
'Ordered List' => '',
'Please wait while uploading...' => '',
'Preview' => '',
'Quote' => '',
'Target' => '',
'Title' => 'Titulli',
'Title of your link' => '',
'URL/Link' => '',
'Unordered List' => '',
'code text here' => '',
'emphasized text' => '',
'enter image description here' => '',
'enter image title here' => '',
'enter link description here' => '',
'heading text' => '',
'list text here' => '',
'quote here' => '',
'strong text' => '',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Lägg till bild/fil',
'Add link' => 'Lägg till länk',
'Bold' => 'Fet',
'Close' => 'Stäng',
'Code' => 'Kod',
'Enter a url (e.g. http://example.com)' => 'Lägg till url (e.g. http://example.com)',
'Heading' => 'Rubrikstil',
'Image' => 'Bild',
'Image/File' => 'Bild/fil',
'Insert Hyperlink' => 'Lägg till hyperlänk',
'Insert Image Hyperlink' => 'Lägg till hyperlänksbild',
'Italic' => 'Kursiv',
'List' => 'Lista',
'Ordered List' => 'Sorterad lista',
'Please wait while uploading...' => 'Vänligen vänta medan uppladdning sker...',
'Preview' => 'Förhandsgranska',
'Quote' => 'Citera',
'Target' => 'Mål',
'Title' => 'Titel',
'Title of your link' => 'Länkrubrik',
'URL/Link' => 'URL/länk',
'Unordered List' => 'Punktlista',
'code text here' => 'Kodtext här',
'emphasized text' => 'kursiverad text',
'enter image description here' => 'Lägg till bildbeskrivning',
'enter image title here' => 'Lägg till bildtitel',
'enter link description here' => 'Lägg till länkbeskrivning',
'heading text' => 'Rubriktext',
'list text here' => 'Listtext här',
'quote here' => 'citera här',
'strong text' => 'fettext här',
);

View File

@ -1,35 +0,0 @@
<?php
return [
'Add image/file' => '',
'Add link' => '',
'Bold' => '',
'Close' => '',
'Code' => '',
'Enter a url (e.g. http://example.com)' => '',
'Heading' => '',
'Image' => '',
'Image/File' => '',
'Insert Hyperlink' => '',
'Insert Image Hyperlink' => '',
'Italic' => '',
'List' => '',
'Ordered List' => '',
'Please wait while uploading...' => '',
'Preview' => '',
'Quote' => '',
'Target' => '',
'Title' => '',
'Title of your link' => '',
'URL/Link' => '',
'Unordered List' => '',
'code text here' => '',
'emphasized text' => '',
'enter image description here' => '',
'enter image title here' => '',
'enter link description here' => '',
'heading text' => '',
'list text here' => '',
'quote here' => '',
'strong text' => '',
];

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'เพิ่มรูปภาพ/ไฟล์',
'Add link' => 'เพิ่มลิงค์',
'Bold' => 'ตัวหนา',
'Close' => 'ปิด',
'Code' => 'รหัส',
'Enter a url (e.g. http://example.com)' => 'ป้อน URL (เช่น http://example.com)',
'Heading' => 'หัวเรื่อง',
'Image' => 'ภาพ',
'Image/File' => 'ภาพ/ไฟล์',
'Insert Hyperlink' => 'แทรกไฮเปอร์ลิงก์',
'Insert Image Hyperlink' => 'แทรกรูปภาพไฮเปอร์ลิงก์',
'Italic' => 'ตัวเอียง',
'List' => 'รายการ',
'Ordered List' => 'รายการสั่งซื้อ',
'Please wait while uploading...' => 'กรุณารอสักครู่ขณะอัปโหลด...',
'Preview' => 'ดูตัวอย่าง',
'Quote' => 'ใบเสนอราคา',
'Target' => 'เป้าหมาย',
'Title' => 'หัวข้อ',
'Title of your link' => 'ชื่อลิงค์ของคุณ',
'URL/Link' => 'URL/ลิงค์',
'Unordered List' => 'รายการที่ไม่เรียงลำดับ',
'code text here' => 'ข้อความรหัสที่นี่',
'emphasized text' => 'เน้นข้อความ',
'enter image description here' => 'ใส่คำอธิบายภาพที่นี่',
'enter image title here' => 'ใส่ชื่อภาพที่นี่',
'enter link description here' => 'ใส่คำอธิบายลิงค์ที่นี่',
'heading text' => 'ข้อความหัวเรื่อง',
'list text here' => 'รายการข้อความที่นี่',
'quote here' => 'อ้างที่นี่',
'strong text' => 'ข้อความที่แข็งแกร่ง',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Resim/Dosya Ekle',
'Add link' => 'Link Ekle',
'Bold' => 'Kalın',
'Close' => 'Kapat',
'Code' => 'Kod',
'Enter a url (e.g. http://example.com)' => 'Url girin (Örnek: http://example.com)',
'Heading' => 'Başlık',
'Image' => 'Resim',
'Image/File' => 'Resim/Dosya',
'Insert Hyperlink' => 'Bağlantı Ekle',
'Insert Image Hyperlink' => 'Resim Bağlantısı Ekle',
'Italic' => 'İtalik',
'List' => 'Liste',
'Ordered List' => 'Düzenlenen Liste',
'Please wait while uploading...' => 'Yüklenirken lütfen bekleyin...',
'Preview' => 'Görüntüle',
'Quote' => 'Alıntı',
'Target' => 'Hedef',
'Title' => 'Başlık',
'Title of your link' => 'Bağlantı Başlığı',
'URL/Link' => 'URL/Adres',
'Unordered List' => 'Düzenlenmeyen Liste',
'code text here' => 'kod metni girin',
'emphasized text' => 'vurgulanan metin',
'enter image description here' => 'resim açıklaması girin',
'enter image title here' => 'resim başlığını girin',
'enter link description here' => 'bağlantııklaması girin',
'heading text' => 'başlık metni',
'list text here' => 'metin listesi girin',
'quote here' => 'alıntı girin',
'strong text' => 'kalın metin',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => '',
'Add link' => '',
'Bold' => '',
'Close' => 'Закрити',
'Code' => 'Код',
'Enter a url (e.g. http://example.com)' => '',
'Heading' => 'Заголовок',
'Image' => 'Зображення',
'Image/File' => '',
'Insert Hyperlink' => '',
'Insert Image Hyperlink' => '',
'Italic' => '',
'List' => '',
'Ordered List' => '',
'Please wait while uploading...' => '',
'Preview' => '',
'Quote' => '',
'Target' => '',
'Title' => 'Заголовок',
'Title of your link' => '',
'URL/Link' => '',
'Unordered List' => '',
'code text here' => '',
'emphasized text' => '',
'enter image description here' => '',
'enter image title here' => '',
'enter link description here' => '',
'heading text' => '',
'list text here' => '',
'quote here' => '',
'strong text' => '',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => '',
'Add link' => '',
'Bold' => '',
'Close' => '',
'Code' => '',
'Enter a url (e.g. http://example.com)' => '',
'Heading' => '',
'Image' => '',
'Image/File' => '',
'Insert Hyperlink' => '',
'Insert Image Hyperlink' => '',
'Italic' => '',
'List' => '',
'Ordered List' => '',
'Please wait while uploading...' => '',
'Preview' => '',
'Quote' => '',
'Target' => '',
'Title' => 'Sarlavha',
'Title of your link' => '',
'URL/Link' => '',
'Unordered List' => '',
'code text here' => '',
'emphasized text' => '',
'enter image description here' => '',
'enter image title here' => '',
'enter link description here' => '',
'heading text' => '',
'list text here' => '',
'quote here' => '',
'strong text' => '',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => 'Thêm image/file',
'Add link' => 'Thêm link',
'Bold' => 'In đậm',
'Close' => 'Đóng',
'Code' => 'Mã',
'Enter a url (e.g. http://example.com)' => 'Nhập địa chỉ url (VD: http://vietnam.com)',
'Heading' => 'Heading',
'Image' => 'Ảnh',
'Image/File' => 'Ảnh/Tệp tin',
'Insert Hyperlink' => 'Chèn liên kết',
'Insert Image Hyperlink' => 'Chèn liên kết ảnh',
'Italic' => 'In nghiêng',
'List' => 'Danh sách',
'Ordered List' => 'Danh sách có thứ tự',
'Please wait while uploading...' => 'Vui lòng đợi upload...',
'Preview' => 'Xem trước',
'Quote' => 'Trích dẫn',
'Target' => 'Mục tiêu',
'Title' => 'Tiêu đề',
'Title of your link' => 'Tiêu đề liên kết',
'URL/Link' => 'URL/Link',
'Unordered List' => 'Danh sách phi thứ tự',
'code text here' => 'Nhập nội dung Mã ở đây',
'emphasized text' => 'In đậm chữ',
'enter image description here' => 'Nhập nội dung mô tả ảnh',
'enter image title here' => 'Nhập tiêu đề ảnh',
'enter link description here' => 'Nhập mô tả link',
'heading text' => 'chữ heading',
'list text here' => 'Nhập nội dung danh sách ở đây',
'quote here' => 'Nhập nội dung Trích dẫn ở đây',
'strong text' => 'bôi đậm chữ',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => '添加 图片/文件',
'Add link' => '增加链接',
'Bold' => '加粗',
'Close' => '关闭',
'Code' => '代码',
'Enter a url (e.g. http://example.com)' => '输入一个url(例如 http://example.com)',
'Heading' => '标题',
'Image' => '图片',
'Image/File' => '图片/文件',
'Insert Hyperlink' => '插入超链接',
'Insert Image Hyperlink' => '插入图片超链接',
'Italic' => '斜体',
'List' => '列表',
'Ordered List' => '有序列表',
'Please wait while uploading...' => '请稍候正在上传中...',
'Preview' => '预览',
'Quote' => '引用',
'Target' => '目标',
'Title' => '标题',
'Title of your link' => '链接的标题',
'URL/Link' => 'URL/链接',
'Unordered List' => '无序列表',
'code text here' => '代码在这里',
'emphasized text' => '强调文本',
'enter image description here' => '在这里输入图像描述',
'enter image title here' => '在这里输入图像标题',
'enter link description here' => '在这里输入链接描述',
'heading text' => '标题文本',
'list text here' => '列表在这里',
'quote here' => '这里引用',
'strong text' => '加粗文本',
);

View File

@ -1,34 +0,0 @@
<?php
return array (
'Add image/file' => '添加圖像/文件',
'Add link' => '添加連結',
'Bold' => '粗體',
'Close' => '關閉',
'Code' => '程式碼',
'Enter a url (e.g. http://example.com)' => '輸入一個網址 (例如: http://example.com)',
'Heading' => '標題',
'Image' => '圖像',
'Image/File' => '圖像/文件',
'Insert Hyperlink' => '插入超連結',
'Insert Image Hyperlink' => '插入圖像超連結',
'Italic' => '斜體',
'List' => '清單',
'Ordered List' => '編號清單',
'Please wait while uploading...' => '上傳中請稍候...',
'Preview' => '預覽',
'Quote' => '引用',
'Target' => '目標框架',
'Title' => '標題',
'Title of your link' => '連結的標題',
'URL/Link' => 'URL網址/連結',
'Unordered List' => '項目符號清單',
'code text here' => '在這裡輸入程式碼文字',
'emphasized text' => '強調文字',
'enter image description here' => '在這裡輸入圖像說明',
'enter image title here' => '在這裡輸入圖像標題',
'enter link description here' => '在這裡輸入連結說明',
'heading text' => '標題文字',
'list text here' => '在這裡輸入清單文字',
'quote here' => '在這裡輸入引用文字',
'strong text' => '粗體字',
);

View File

@ -3,7 +3,6 @@
use humhub\modules\content\widgets\richtext\RichText;
use yii\helpers\Html;
use humhub\modules\user\models\fieldtype\MarkdownEditor;
use humhub\widgets\MarkdownView;
/**
* @var $this \humhub\modules\ui\view\components\View

View File

@ -10,7 +10,6 @@ namespace humhub\widgets;
use humhub\modules\admin\widgets\TrackingWidget;
use humhub\modules\tour\widgets\Tour;
use humhub\modules\ui\form\widgets\MarkdownModals;
use Yii;
/**
@ -41,7 +40,6 @@ class LayoutAddons extends BaseStack
if (Yii::$app->params['installed']) {
$this->addWidget(BlueimpGallery::class);
$this->addWidget(MarkdownModals::class);
if (Yii::$app->params['enablePjax']) {
$this->addWidget(PjaxLayoutContent::class);

View File

@ -1,84 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2015 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\widgets;
use Exception;
/**
* MarkdownViewWidget shows Markdown flavored content
*
* @author luke
* @since 0.11
*/
class MarkdownView extends \yii\base\Widget
{
/**
* Markdown to parse
*
* @var string
*/
public $markdown = "";
/**
* Markdown parser class
*
* @var string
*/
public $parserClass = "humhub\libs\Markdown";
/**
* Purify output after parsing
*
* @var boolean
*/
public $purifyOutput = true;
/**
* Stylesheet for Highlight.js
*/
public $highlightJsCss = "github";
/**
* @var boolean return plain output (do not use widget template)
*/
public $returnPlain = false;
public function init()
{
if (!\humhub\libs\Helpers::CheckClassType($this->parserClass, "cebe\markdown\Parser")) {
throw new Exception("Invalid markdown parser class given!");
}
}
public function run()
{
$this->markdown = \yii\helpers\Html::encode($this->markdown);
$parserClass = $this->parserClass;
$parser = new $parserClass;
$html = $parser->parse($this->markdown);
if ($this->purifyOutput) {
$html = \yii\helpers\HtmlPurifier::process($html, function ($config) {
$config->set('URI.AllowedSchemes', ['http' => true, 'https' => true, 'mailto' => true, 'ftp' => true, 'file' => true]);
$config->getHTMLDefinition(true)
->addAttribute('a', 'target', 'Text');
});
}
if ($this->returnPlain) {
return $html;
}
return $this->render('markdownView', ['content' => $html, 'highlightJsCss' => $this->highlightJsCss]);
}
}

View File

@ -1,120 +0,0 @@
<?php
use humhub\modules\ui\form\assets\MarkdownFieldAsset;
use yii\helpers\Url;
use yii\helpers\Html;
/**
* Register BootstrapMarkdown & changes
*/
MarkdownFieldAsset::register($this);
/**
* Create a hidden field to store uploaded files guids
*/
echo Html::hiddenInput('fileUploaderHiddenGuidField', "", ['id' => 'fileUploaderHiddenGuidField_' . $fieldId]);
$this->registerJsVar('markdownPreviewUrl', $previewUrl);
$translations = [
'Bold' => Yii::t('UiModule.markdownEditor', 'Bold'),
'Italic' => Yii::t('UiModule.markdownEditor', 'Italic'),
'Heading' => Yii::t('UiModule.markdownEditor', 'Heading'),
'URL/Link' => Yii::t('UiModule.markdownEditor', 'URL/Link'),
'Image/File' => Yii::t('UiModule.markdownEditor', 'Image/File'),
'Image' => Yii::t('UiModule.markdownEditor', 'Image'),
'List' => Yii::t('UiModule.markdownEditor', 'List'),
'Preview' => Yii::t('UiModule.markdownEditor', 'Preview'),
'strong text' => Yii::t('UiModule.markdownEditor', 'strong text'),
'emphasized text' => Yii::t('UiModule.markdownEditor', 'emphasized text'),
'heading text' => Yii::t('UiModule.markdownEditor', 'heading text'),
'enter link description here' => Yii::t('UiModule.markdownEditor', 'enter link description here'),
'Insert Hyperlink' => Yii::t('UiModule.markdownEditor', 'Insert Hyperlink'),
'enter image description here' => Yii::t('UiModule.markdownEditor', 'enter image description here'),
'Insert Image Hyperlink' => Yii::t('UiModule.markdownEditor', 'Insert Image Hyperlink'),
'enter image title here' => Yii::t('UiModule.markdownEditor', 'enter image title here'),
'list text here' => Yii::t('UiModule.markdownEditor', 'list text here'),
'Quote' => Yii::t('UiModule.markdownEditor', 'Quote'),
'quote here' => Yii::t('UiModule.markdownEditor', 'quote here'),
'Code' => Yii::t('UiModule.markdownEditor', 'Code'),
'code text here' => Yii::t('UiModule.markdownEditor', 'code text here'),
'Unordered List' => Yii::t('UiModule.markdownEditor', 'Unordered List'),
'Ordered List' => Yii::t('UiModule.markdownEditor', 'Ordered List'),
];
$translationsJS = "$.fn.markdown.messages['en'] = {\n";
foreach ($translations as $key => $value) {
$translationsJS .= "\t'" . $key . "': '" . Html::encode($value) . "',\n";
}
$translationsJS .= "};\n";
$this->registerJs($translationsJS);
$this->registerJs("initMarkdownEditor('" . $fieldId . "')");
?>
<?php
/**
* We need to use this script part since a markdown editor can also included
* into a modal. So we need to append MarkdownEditors modals later to body.
*/
?>
<script <?= \humhub\libs\Html::nonce() ?> id="markdownEditor_dialogs_<?php echo $fieldId; ?>" type="text/placeholder">
<div class="modal modal-top" id="addFileModal_<?php echo $fieldId; ?>" tabindex="-1" role="dialog" aria-labelledby="addImageModalLabel" style="z-index:99999" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="addImageModalLabel"><?php echo Yii::t('UiModule.markdownEditor', 'Add image/file'); ?></h4>
</div>
<div class="modal-body">
<div class="uploadForm">
<?php echo Html::beginForm('', 'post'); ?>
<input class="fileUploadButton" type="file"
name="files[]"
data-url="<?php echo Url::to(['/file/file/upload']); ?>"
multiple>
<?php echo Html::endForm(); ?>
</div>
<div class="uploadProgress">
<strong><?php echo Yii::t('UiModule.markdownEditor', 'Please wait while uploading...'); ?></strong>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo Yii::t('UiModule.markdownEditor', 'Close'); ?></button>
</div>
</div>
</div>
</div>
<div class="modal modal-top" id="addLinkModal_<?php echo $fieldId; ?>" tabindex="-1" role="dialog" style="z-index:99999" aria-labelledby="addLinkModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="addLinkModalLabel"><?php echo Yii::t('UiModule.markdownEditor', 'Add link'); ?></h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="addLinkTitle"><?php echo Yii::t('UiModule.markdownEditor', 'Title'); ?></label>
<input type="text" class="form-control linkTitle"
placeholder="<?php echo Yii::t('UiModule.markdownEditor', 'Title of your link'); ?>">
</div>
<div class="form-group">
<label for="addLinkTarget"><?php echo Yii::t('UiModule.markdownEditor', 'Target'); ?></label>
<input type="text" class="form-control linkTarget"
placeholder="<?php echo Yii::t('UiModule.markdownEditor', 'Enter a url (e.g. http://example.com)'); ?>">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo Yii::t('UiModule.markdownEditor', 'Close'); ?></button>
<button type="button" class="btn btn-primary addLinkButton"><?php echo Yii::t('UiModule.markdownEditor', 'Add link'); ?></button>
</div>
</div>
</div>
</div>
</script>

View File

@ -1,55 +0,0 @@
<?php
use humhub\modules\file\widgets\UploadButton;
use humhub\widgets\Button;
use humhub\widgets\ModalButton;
use humhub\widgets\ModalDialog;
?>
<div class="modal modal-top" id="markdown-modal-file-upload" tabindex="-1" role="dialog" style="z-index:99999" aria-hidden="true">
<?php ModalDialog::begin(['header' => Yii::t('UiModule.markdownEditor', 'Add image/file')])?>
<div class="modal-body">
<div class="uploadForm">
<?= UploadButton::widget([
'id' => 'markdown-file-upload',
'label' => true,
'tooltip' => false,
'progress' => '#markdown-modal-upload-progress',
'cssButtonClass' => 'btn-default btn-sm',
'dropZone' => '#markdown-modal-file-upload',
'hideInStream' => true
]) ?>
</div>
<br>
<div id="markdown-modal-upload-progress" style="display:none"></div>
</div>
<div class="modal-footer">
<?= ModalButton::cancel(Yii::t('base', 'Close')) ?>
</div>
<?php ModalDialog::end() ?>
</div>
<div class="modal modal-top" id="markdown-modal-add-link" tabindex="-1" role="dialog" style="z-index:99999" aria-hidden="true">
<?php ModalDialog::begin(['header' => Yii::t('UiModule.markdownEditor', 'Add link')])?>
<div class="modal-body">
<div class="form-group">
<label for="addLinkTitle"><?= Yii::t('UiModule.markdownEditor', 'Title'); ?></label>
<input type="text" class="form-control linkTitle"
placeholder="<?= Yii::t('UiModule.markdownEditor', 'Title of your link'); ?>">
</div>
<div class="form-group">
<label for="addLinkTarget"><?= Yii::t('UiModule.markdownEditor', 'Target'); ?></label>
<input type="text" class="form-control linkTarget"
placeholder="<?= Yii::t('UiModule.markdownEditor', 'Enter a url (e.g. http://example.com)'); ?>">
</div>
</div>
<div class="modal-footer">
<?= ModalButton::cancel(Yii::t('base', 'Close')) ?>
<?= Button::primary(Yii::t('UiModule.markdownEditor', 'Add link'))->cssClass('addLinkButton')->loader(false) ?>
</div>
<?php ModalDialog::end() ?>
</div>

View File

@ -1,7 +0,0 @@
<?php
/* @var $content string */
?>
<div class="markdown-render">
<?= $content; ?>
</div>

Some files were not shown because too many files have changed in this diff Show More