Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jquery-textileToolbar-rails
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maurizio Manetti
jquery-textileToolbar-rails
Commits
fbd4ada0
Commit
fbd4ada0
authored
6 years ago
by
Maurizio Manetti
Browse files
Options
Downloads
Patches
Plain Diff
Update code to version 0.0.3 of jquery-textiletoolbar
parent
2bf37b0f
Branches
master
Tags
v0.0.3
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/assets/javascripts/textileToolbar/jquery.textileToolbar.js
+47
-4
47 additions, 4 deletions
...ssets/javascripts/textileToolbar/jquery.textileToolbar.js
lib/jquery/textileToolbar/rails/version.rb
+1
-1
1 addition, 1 deletion
lib/jquery/textileToolbar/rails/version.rb
with
48 additions
and
5 deletions
app/assets/javascripts/textileToolbar/jquery.textileToolbar.js
+
47
−
4
View file @
fbd4ada0
...
...
@@ -124,7 +124,7 @@
}
}
// default toolbar
// default toolbar
options
var
defaults
=
{
buttons
:
buttons
,
toolbar
:
[
...
...
@@ -145,7 +145,17 @@
"
spacer
"
,
"
img
"
,
"
link
"
]
],
placement
:
'
beforeElement
'
/*
Possible placement values:
string 'beforeElement' default: place toolbar div immediately before the textarea
string 'afterElement' place toolbar div immediately after the textarea
string 'beforeParent' place toolbar div before the textarea's parent container
string 'afterParent' place toolbar div after the textarea's parent container
function callback returning jQuery element before which to place the toolbar
*/
};
function
TextileToolbar
(
element
,
options
)
{
...
...
@@ -154,6 +164,7 @@
this
.
settings
=
{};
this
.
settings
.
toolbar
=
options
.
toolbar
||
defaults
.
toolbar
;
this
.
settings
.
buttons
=
$
.
extend
(
{},
defaults
.
buttons
,
options
.
buttons
);
this
.
settings
.
placement
=
options
.
placement
||
defaults
.
placement
;
this
.
_defaults
=
defaults
;
this
.
_name
=
pluginName
;
this
.
init
();
...
...
@@ -240,11 +251,14 @@
TextileToolbar
.
prototype
.
init
=
function
()
{
var
settings
=
this
.
settings
;
var
textarea
=
this
.
textarea
;
var
placement
=
this
.
settings
.
placement
;
var
toolbar
=
this
;
var
toolbarDiv
=
$
(
"
<div class=
\"
textile-toolbar
\"
></div>
"
);
var
htmlButton
;
var
defaultPlacement
=
function
()
{
$
(
toolbarDiv
).
insertBefore
(
textarea
);};
// create buttons based on the configuration
$
.
each
(
settings
.
toolbar
,
function
(
index
,
buttonName
)
{
var
button
=
settings
.
buttons
[
buttonName
];
...
...
@@ -295,8 +309,37 @@
toolbarDiv
.
append
(
htmlButton
);
});
$
(
textarea
).
before
(
toolbarDiv
);
// insert toolbar based on settings placement:
if
(
typeof
placement
===
"
string
"
)
{
switch
(
placement
)
{
case
"
beforeElement
"
:
$
(
toolbarDiv
).
insertBefore
(
textarea
);
break
;
case
"
afterElement
"
:
$
(
toolbarDiv
).
insertAfter
(
textarea
);
break
;
case
"
beforeParent
"
:
$
(
toolbarDiv
).
insertBefore
(
$
(
textarea
).
parent
());
break
;
case
"
afterPrent
"
:
$
(
toolbarDiv
).
insertAfter
(
$
(
textarea
).
parent
());
break
;
default
:
console
.
warn
(
"
Unexpected placement indication:
\"
%s
\"
. Using default.
"
,
placement
);
defaultPlacement
();
}
}
else
if
(
typeof
placement
===
"
function
"
)
{
var
element
=
placement
();
if
(
typeof
element
===
"
undefined
"
||
element
.
length
===
0
)
{
console
.
warn
(
"
Placement function did not return any matching element: using default
"
);
defaultPlacement
();
}
else
{
$
(
toolbarDiv
).
insertBefore
(
element
);
}
}
else
{
defaultPlacement
();
}
};
TextileToolbar
.
prototype
.
_reset
=
function
(){
...
...
This diff is collapsed.
Click to expand it.
lib/jquery/textileToolbar/rails/version.rb
+
1
−
1
View file @
fbd4ada0
module
Jquery
module
TextileToolbar
module
Rails
VERSION
=
"0.0.
2
"
VERSION
=
"0.0.
3
"
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment